This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 119
/
Copy pathbuild.gradle
146 lines (128 loc) · 3.99 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// Tasks to perform when no task is specified
defaultTasks 'clean', 'build', 'remap'
// Plugins used
apply plugin: 'java' // Specifies a java project
apply plugin: 'application' // Adds the 'run' task
apply plugin: 'project-report' // Adds project report tasks
apply plugin: 'eclipse' // Adds eclipse project tasks
apply plugin: 'idea' // Adds idea project tasks
apply plugin: 'com.github.johnrengelman.shadow' // Provides dependency shading
apply plugin: 'net.glowstone.remapper' // Provides method remapping
apply plugin: 'checkstyle' // Checks code style
apply from: 'etc/publish.gradle'
// Methods to determine detailed version string
def gitDescribe() {
try {
// determine git-describe output
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--always', '--dirty=*'
standardOutput = stdout
}
return stdout.toString().trim()
} catch (e) {
return "unknown"
}
}
def getVersionName() {
try {
// determine git-describe output
def version = gitDescribe()
// add on jenkins or travis build information
def jenkins_build = System.getenv("BUILD_NUMBER")
def travis_build = System.getenv("TRAVIS_BUILD_NUMBER")
if (jenkins_build != null) {
version += "-b" + jenkins_build
} else if (travis_build != null) {
version += "-trv" + travis_build
} else {
version += "-dev"
}
return version
} catch (e) {
return "unknown-version"
}
}
// Basic project information
group = 'net.glowstone'
version = '0.0.1-SNAPSHOT'
description = "Glowstone"
mainClassName = "net.glowstone.GlowServer"
// Extended project information
ext.url = 'https://github.com/GlowstoneMC/Glowstone'
ext.bukkitVersion = '1.8-R1-SNAPSHOT'
ext.gitDescribe = getVersionName()
ext.lombok = 'org.projectlombok:lombok:1.14.8'
// Minimum Java version required
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
// Compile encoding
compileJava {
options.encoding = 'UTF-8'
}
// Simple build script information
buildscript {
repositories {
jcenter()
maven { url "http://repo.glowstone.net/content/groups/public/" }
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.0'
classpath 'net.glowstone:remapper:1.1'
classpath 'org.ow2.asm:asm:5.0.3'
}
}
// Configuration settings to check for new snapshots
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds' // Always check for new snapshots
}
// Repositories storing our dependencies
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/public/" }
maven { url "http://repo.glowstone.net/content/groups/public/" }
}
// Dependencies used by our project
dependencies {
compile group: 'net.glowstone', name: 'glowkit', version: project.ext.bukkitVersion
compile 'com.flowpowered:flow-networking:1.0.0-SNAPSHOT'
compile 'jline:jline:2.11'
//compile 'mysql:mysql-connector-java:5.1.14'
//compile 'org.xerial:sqlite-jdbc:3.7.2'
compile 'org.slf4j:slf4j-jdk14:1.7.7'
compile lombok
testCompile 'junit:junit:4.8.1'
}
// Checkstyle plugin settings
checkstyle {
configFile = file('etc/checkstyle.xml')
}
// Shadow plugin settings
shadowJar {
dependencies {
exclude(dependency(lombok))
}
}
// Remap plugin settings
remap {
mappingFile = file('etc/remapper.txt')
inputTask = shadowJar
}
// Eclipse project name
eclipse {
project {
name = 'Glowstone'
}
}
// Jar manifest information
jar.manifest.mainAttributes(
'Main-Class': mainClassName,
'Implementation-Title': description,
'Implementation-Version': ext.gitDescribe,
'Implementation-Vendor': 'Glowstone Project',
'Specification-Title': 'Bukkit/Glowkit',
'Specification-Version': ext.bukkitVersion,
'Specification-Vendor': 'Glowstone Project',
'Sealed': true
)