forked from MovingBlocks/Terasology
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
239 lines (213 loc) · 6.45 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
/*
* This is a Gradle build file:
* - Gradle Homepage: http://gradle.org/
* - Gradle Installation: http://gradle.org/installation
* - View tasks for this project: $ gradle tasks
*/
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'eclipse'
apply plugin: 'idea'
task extractWindowsNatives(type:Copy) {
from {
configurations.compile.collect { it.getName().contains('-natives-window') ? zipTree(it) : [] }
}
into ('natives/windows')
exclude ('META-INF/**')
}
task extractMacOSXNatives(type:Copy) {
from {
configurations.compile.collect { it.getName().contains('-natives-osx') ? zipTree(it) : [] }
}
into ('natives/macosx')
exclude ('META-INF/**')
}
task extractLinuxNatives(type:Copy) {
from {
configurations.compile.collect { it.getName().contains('-natives-linux') ? zipTree(it) : [] }
}
into ('natives/linux')
exclude ('META-INF/**')
}
task extractNatives {
dependsOn extractWindowsNatives
dependsOn extractLinuxNatives
dependsOn extractMacOSXNatives
}
idea {
project {
jdkName = '1.6'
languageLevel = '1.6'
ipr {
withXml { provider ->
provider.node.component.find { it.@name == 'ProjectRootManager' }.output.@url = 'file://$PROJECT_DIR$/target'
}
}
}
module {
inheritOutputDirs = false
outputDir = file('target/classes/main')
testOutputDir = file('target/classes/test')
testSourceDirs += file('src/perfTest/java')
excludeDirs += file('protobuf')
excludeDirs += file('blender_addons')
excludeDirs += file('gradle')
excludeDirs += file('rawAssets')
excludeDirs += file('logs')
excludeDirs += file('SAVED_WORLDS')
excludeDirs += file('target')
excludeDirs += file('out')
}
}
ideaModule.dependsOn extractNatives
eclipseClasspath.dependsOn extractNatives
sourceCompatibility = 1.6
//version = '0.5.0' //TODO: Disabled version tagging until we actually have something solid to do with it (was breaking old artifact links)
buildDir = 'target'
task wrapper(type: Wrapper) {
gradleVersion = '1.0-milestone-8a'
}
// Compiles everything as groovy, due to java<->groovy interdependencies
sourceSets {
main {
java { srcDirs = [] }
groovy { srcDirs = ['src/main/java','src/main/groovy'] }
resources { srcDir = 'src/main/resources' }
output.resourcesDir = 'target/classes/main'
}
perfTest
}
test {
//Uncomment to makes the standard streams (err and out) visible at console when running tests
//testLogging.showStandardStreams = true
jvmArgs '-Xms512m', '-Xmx1024m', '-XX:MaxPermSize=128m'
}
task perfTests(type: Test) {
testClassesDir = sourceSets.perfTest.output.classesDir
classpath = sourceSets.perfTest.runtimeClasspath
jvmArgs '-Xms512m', '-Xmx1024m', '-XX:MaxPermSize=128m'
}
repositories {
mavenCentral()
}
dependencies{
groovy group: 'org.codehaus.groovy', name: 'groovy', version: '1.8.2'
compile group: 'com.google.guava', name: 'guava', version: '11.0.1'
compile group: 'com.google.code.gson', name: 'gson', version: '2.1'
compile group: 'com.google.protobuf', name: 'protobuf-java', version: '2.4.1'
compile group: 'net.sf.trove4j', name: 'trove4j', version: '3.0.2'
compile group: 'com.projectdarkstar.ext.jorbis', name: 'jorbis', version: '0.0.17'
compile group: 'org.lwjgl.lwjgl', name: 'lwjgl', version: '2.8.3'
compile group: 'org.lwjgl.lwjgl', name: 'lwjgl_util', version: '2.8.3'
compile fileTree(dir: 'libs', include: '*.jar')
testCompile group: 'junit', name: 'junit', version: '4.10'
testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.0'
perfTestCompile sourceSets.main.output
perfTestCompile configurations.testCompile
perfTestCompile sourceSets.test.output
perfTestRuntime configurations.testRuntime
}
jar {
manifest {
def manifestClasspath = 'libs/'+configurations.runtime.collect { it.getName() }.join(' libs/')
attributes("Main-Class": "org.terasology.game.Terasology", "Manifest-Version": "1.0", "Class-Path" : manifestClasspath)
}
archiveName('Terasology.jar')
}
jar.doFirst {
// Work around for duplicate entries in jar bug
sourceSets.main.output.resourcesDir = '/dev/null'
}
jar.doLast {
ant.signjar(jar: jar.archivePath, keystore: 'applet/tera.keystore', alias: 'Terasology', storepass: 'Terasology')
sourceSets.main.output.resourcesDir = 'target/classes/main'
}
task distLibs(type:Copy) {
from {
configurations.compile.collect { !it.isDirectory() && !it.getName().contains('-natives-') ? it : [] }
}
into('target/dist/libs')
}
task distMods {
mkdir('target/dist/mods')
file('mods').listFiles().each { File mod ->
if (mod.isDirectory() ) {
task('distMod-' + mod.getName(), type: Zip) {
from (mod)
archiveName = mod.getName() + '.zip'
destinationDir = file('target/dist/mods/')
}
distMods.dependsOn tasks['distMod-' + mod.getName()]
}
}
}
task dist(type:Copy) {
description = 'Creates a fully-functional game folder.'
dependsOn jar
dependsOn extractNatives
dependsOn distLibs
dependsOn distMods
from('.') {
include 'README.markdown'
include 'LICENSE.txt'
include 'natives/**'
include 'data/**'
}
from('launchScripts') {
exclude('Launcher.xml')
}
from(jar.archivePath)
into('target/dist')
}
task zip(type:Zip) {
description = 'Creates a fully-functionional game archive.'
dependsOn dist
from('target/dist')
into('Terasology')
destinationDir = buildDir
}
task appletMods {
mkdir('target/applet/mods')
file('mods').listFiles().each { File mod ->
if (mod.isDirectory() ) {
task('appletMod-' + mod.getName(), type: Zip) {
from (mod)
archiveName = mod.getName() + '.zip'
destinationDir = file('target/applet/mods/')
}
appletMods.dependsOn tasks['appletMod-' + mod.getName()]
}
}
}
task appletLibs(type:Copy) {
from {
configurations.compile.collect { !it.isDirectory() ? it : [] }
}
into('target/applet/libs')
exclude { details -> details.file.name.contains("lwjgl") || details.file.name.contains("jinput") }
}
task applet(type:Copy) {
description = 'Creates a game distribution playable through a browser.'
dependsOn jar
dependsOn appletLibs
dependsOn appletMods
from('applet') {
exclude '*.keystore'
}
from (jar.archivePath)
into('target/applet')
}
applet.doLast {
file('target/applet/libs').listFiles().each {
if (it.getName().endsWith(".jar"))
ant.signjar(jar: it, keystore: 'applet/tera.keystore', alias: 'Terasology', storepass: 'Terasology')
}
}
task run(type:JavaExec) {
description = 'Run Terasology'
dependsOn extractNatives
dependsOn classes
main = 'org.terasology.game.Terasology'
classpath sourceSets.main.output.classesDir
classpath configurations.runtime
}