forked from triplea-game/triplea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
178 lines (154 loc) · 4.91 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
buildscript {
repositories {
maven { url 'http://maven.ej-technologies.com/repository' }
}
dependencies {
classpath group: 'com.install4j', name: 'gradle-plugin', version: '6.0.4'
}
}
plugins {
id 'java'
id 'application'
id 'checkstyle'
id 'com.github.ben-manes.versions' version '0.12.0'
id 'com.github.johnrengelman.shadow' version '1.2.3'
id "de.qaware.seu.as.code.git" version "2.2.0"
}
version = System.getenv("TAGGED_VERSION") ?: ""
group = 'triplea'
description = 'TripleA is a free online turn based strategy game and board game engine, similar to such board games as Axis & Allies or Risk.'
mainClassName = "games.strategy.engine.framework.GameRunner"
compileJava {
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:all"
}
compileTestJava {
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:all"
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.withType(JavaCompile) {
options.incremental = true
}
checkstyle{
configFile = rootProject.file('gradle/google_checks.xml')
toolVersion = "7.1"
showViolations = false
}
jar {
manifest {
attributes 'Main-Class': mainClassName, 'TripleA-Version': version
}
}
repositories {
jcenter()
}
dependencies {
compile 'com.github.insubstantial:substance:7.3'
compile 'com.google.guava:guava:19.0'
compile 'com.googlecode.soundlibs:jlayer:1.0.1-2'
compile 'com.sun.mail:mailapi:1.5.5'
compile 'com.sun.mail:smtp:1.5.5'
compile 'org.apache.httpcomponents:httpclient:4.5.2'
compile 'org.apache.httpcomponents:httpmime:4.5.2'
compile 'org.apache.commons:commons-math3:3.6.1'
compile 'org.mindrot:jbcrypt:0.3m'
compile 'org.yaml:snakeyaml:1.17'
compile files('lib/AppleJavaExtensions-1.6.jar')
compile files('lib/upnp.jar')
testCompile 'org.apache.derby:derby:10.10.1.1'
testCompile 'org.hamcrest:java-hamcrest:2.0.0.0'
testCompile 'org.mockito:mockito-core:2.0.82-beta'
testCompile 'junit:junit:4.12'
}
test {
testLogging {
exceptionFormat = 'full'
}
}
def assetsDirectory = file("${buildDir}/assets")
git {
assets {
url 'https://github.com/triplea-game/assets.git'
directory assetsDirectory
branch 'master'
singleBranch true
}
}
task renameShadowJar(type: Copy, group: 'release', dependsOn: [shadowJar]) {
ext.output = file("$project.buildDir/libs/all/triplea.jar")
from shadowJar.archivePath
into ext.output.parent
rename shadowJar.archivePath.name, output.name
}
task updateAssets(dependsOn: ['gitCloneAssets', 'gitPullAssets']) {
}
task allPlatform(type: Zip, group: 'release', dependsOn: [renameShadowJar, updateAssets]) {
classifier 'all_platforms'
['assets', 'dice_servers', 'maps', 'old'].each { folder ->
from(folder) {
into(folder)
}
}
from("${assetsDirectory}/icons") {
into('icons')
exclude("icon.icns")
}
['readme.html', 'changelog.txt', 'system.ini', 'game_engine.properties', 'lobby_server.yaml',
'run-headless-game-host-mac-os.sh', 'run-headless-game-host.sh', 'run-headless-game-host-windows.bat',
'triplea_unix.sh', 'triplea_windows.bat', 'triplea_mac_os_x.sh'].each { fileName ->
from(fileName)
}
from(renameShadowJar.output) {
into('bin')
}
}
task lobbyServer(type: Zip, group: 'release', dependsOn: renameShadowJar) {
classifier 'server'
['run-headless-game-host.sh', 'run-server.sh'].each { fileName ->
from(fileName)
}
from(configurations.testCompile.files { dep -> dep.name == 'derby' }) {
into('lib')
}
from(renameShadowJar.output) {
into('bin')
}
}
task generateZipReleases(group: 'release', dependsOn: [allPlatform, lobbyServer]) {}
apply plugin: 'install4j'
task copyJRE(type: Copy, dependsOn: [updateAssets]) {
from "${assetsDirectory}/install4j/windows-x86-1.8.0_66.tar.gz"
from "${assetsDirectory}/install4j/macosx-amd64-1.8.0_66.tar.gz"
from "${assetsDirectory}/install4j/windows-amd64-1.8.0_66.tar.gz"
into "${System.properties['user.home']}/.install4j6/jres"
}
import com.install4j.gradle.Install4jTask
task generateInstallers(type: Install4jTask, dependsOn: [renameShadowJar, copyJRE], group: 'release') {
projectFile = file('build.install4j')
release project.version
doFirst {
logger.lifecycle("building installer release of version '${project.version}'")
}
}
task setRunnableLinux(dependsOn: [generateInstallers]) {
doLast {
def linuxFile = "triplea_unix_${project.version}.sh"
ant.chmod(dir: "$buildDir/releases", perm: "0755", includes: linuxFile)
}
}
task release(group: 'release', dependsOn: [generateZipReleases, setRunnableLinux]) {}
gradle.taskGraph.whenReady { graph ->
graph.getAllTasks().any({
if (it.name == "generateInstallers") {
if (!project.hasProperty('install4jHomeDir')) {
File propertiesFile = file("${System.getProperty('user.home')}/.gradle/gradle.properties")
throw new RuntimeException("Specify install4jHomeDir in $propertiesFile")
}
def p = file(project.install4jHomeDir)
logger.lifecycle('using install4j home directory ' + p.getAbsolutePath())
it.project.install4j.installDir = file(project.install4jHomeDir)
}
})
}