This repository has been archived by the owner on Sep 3, 2022. It is now read-only.
forked from ggp-org/ggp-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
207 lines (180 loc) · 5.68 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
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
// We compile using Java 7.
sourceCompatibility = 1.7
version = '1.0-SNAPSHOT'
group = 'org.ggp.base'
/*
* For now, instead of using an online library repository (e.g. Maven), we keep
* local versions of .jars to reduce the number of things that can go wrong
* during setup.
*/
repositories {
mavenCentral()
}
dependencies {
compile files(
'lib/Guava/guava-14.0.1.jar',
'lib/Jython/jython.jar',
'lib/Clojure/clojure.jar',
'lib/Batik/batik-1.7.jar',
'lib/FlyingSaucer/core-renderer.jar',
'lib/javassist/javassist.jar',
'lib/reflections/reflections-0.9.9-RC1.jar',
'lib/Htmlparser/htmlparser-1.4.jar',
)
testCompile files(
'lib/JUnit/junit-4.11.jar',
'lib/JUnit/hamcrest-core-1.3.jar',
)
}
// Copy all dependencies into the jar
jar {
from(configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }) {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
}
/*
* Unfortunately, the local-jar approach causes problems when generating a
* .classpath file for Eclipse. This will generate dependency entries that use
* absolute, rather than relative paths, and so can't be committed. To make sure
* committing contributions to the codebase also remains relatively easy, we
* apply a hack here to use relative addresses.
*
* This hasn't been tested in Windows yet; that might need special treatment if
* it tries to use absolute paths with backslashes.
*/
eclipse {
classpath {
file {
withXml {
def node = it.asNode()
for (classpathEntry in node) {
if (classpathEntry.attribute('kind') == 'lib') {
def absolutePath = classpathEntry.attribute('path')
if (absolutePath.contains('/lib/')) {
def startIndex = absolutePath.indexOf('/lib/') + 1
def relativePath = absolutePath.substring(startIndex)
classpathEntry.attributes().put('path', relativePath)
}
}
}
}
}
}
}
/*
* It's convenient when working in Eclipse to have a test suite containing
* all available tests. However, Gradle normally runs every test it can find
* automatically, which would cause all tests to be run twice. This bit of
* configuration prevents that from happening; Gradle just runs the test suite
* instead.
*/
test {
include 'org/ggp/base/test/AllTests.class'
}
//Various applications that can be run from Gradle:
//Note: The clojureConsole task should be run with the -q flag to quiet Gradle's normal output.
task clojureConsole(type: JavaExec) {
main = 'org.ggp.base.apps.consoles.ClojureConsole'
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
}
task pythonConsole(type: JavaExec) {
doFirst {
println classpath.getAsPath()
}
main = 'org.ggp.base.apps.consoles.PythonConsole'
classpath = sourceSets.main.runtimeClasspath
}
/* Not working, no main method found (ant doesn't work in Ant either):
task clojureGamer(type: JavaExec) {
main='org.ggp.base.player.gamer.clojure.ClojureGamer'
classpath = sourceSets.main.runtimeClasspath
}
*/
def playerJvmArgs = ['-mx1500m',
'-server',
'-XX:-DontCompileHugeMethods',
'-XX:MinHeapFreeRatio=10',
'-XX:MaxHeapFreeRatio=10']
//See playerRunner.sh
task playerRunner(type: JavaExec) {
main = 'org.ggp.base.apps.player.PlayerRunner'
classpath = sourceSets.main.runtimeClasspath
//These can be set on the command line with
//-Pport=9147 and -Pgamer=RandomGamer as arguments.
doFirst {
args = [port, gamer]
}
jvmArgs = playerJvmArgs
}
task kiosk(type: JavaExec) {
main = 'org.ggp.base.apps.kiosk.Kiosk'
classpath = sourceSets.main.runtimeClasspath
jvmArgs = playerJvmArgs
}
task server(type: JavaExec) {
main = 'org.ggp.base.apps.server.Server'
classpath = sourceSets.main.runtimeClasspath
}
task simpleGameSim(type: JavaExec) {
main = 'org.ggp.base.apps.utilities.SimpleGameSim'
classpath = sourceSets.main.runtimeClasspath
}
task tiltyardRequestFarm(type: JavaExec) {
main = 'org.ggp.base.apps.tiltyard.TiltyardRequestFarm'
classpath = sourceSets.main.runtimeClasspath
}
task player(type: JavaExec) {
main = 'org.ggp.base.apps.player.Player'
classpath = sourceSets.main.runtimeClasspath
jvmArgs = playerJvmArgs
}
task propNetAnnotater(type: JavaExec) {
main = 'org.ggp.base.util.propnet.factory.annotater.PropNetAnnotater'
classpath = sourceSets.main.runtimeClasspath
}
//See gameServerRunner.sh
task gameServerRunner(type: JavaExec) {
main = 'org.ggp.base.apps.utilities.GameServerRunner'
classpath = sourceSets.main.runtimeClasspath
doFirst {
args = myargs.split().toList()
}
}
// This was used to generate the Gradle wrapper.
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
task sourcesJar(type: Jar) {
from sourceSets.main.java
classifier "sources"
}
task javadocJar(type: Jar, dependsOn: javadoc) {
javadoc.failOnError = false
classifier = 'javadoc'
from javadoc.destinationDir
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact(sourcesJar) {
classifier "sources"
}
artifact(javadocJar) {
classifier "javadoc"
}
}
}
repositories { mavenLocal() }
}
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}