File: build.gradle

package info (click to toggle)
triplea 1.9.0.0.7062-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 25,964 kB
  • sloc: java: 143,218; xml: 70,206; sh: 133; makefile: 7
file content (207 lines) | stat: -rw-r--r-- 6,268 bytes parent folder | download
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
plugins {
    id 'java'
    id 'application'
//    id 'checkstyle'
//    id 'jacoco'
//    id 'com.github.ben-manes.versions' version '0.12.0'
//    id 'com.github.johnrengelman.shadow' version '1.2.3'
//    id 'com.install4j.gradle' version '7.0.1'
//    id 'de.undercouch.download' version '3.2.0'
//    id "net.ltgt.errorprone" version "0.0.11"
}

//apply from: 'gradle/scripts/yaml.gradle'

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"

ext {
    artifactsDir = file("$buildDir/artifacts")
    releasesDir = file("$buildDir/releases")
    rootFilesDir = file("$buildDir/rootFiles")
    schemasDir = file('config/triplea/schemas')

    gameEnginePropertiesFile = file('game_engine.properties')
    gameEnginePropertiesArtifactFile = file("$rootFilesDir/${gameEnginePropertiesFile.name}")
}

def getEngineVersion() {
    if (project.hasProperty('engineVersion')) {
        return project.engineVersion
    }

    def props = new Properties()
    gameEnginePropertiesFile.withInputStream { props.load(it) }
    def devEngineVersion = props.getProperty('engine_version')
    if (devEngineVersion) {
        return "${devEngineVersion}.dev"
    }

    throw new GradleException("unable to determine engine version: "
        + "you must define either the project property 'engineVersion' or the game engine property 'engine_version'")
}

version = getEngineVersion()

sourceSets {
    integTest {
        java.srcDir 'src/integ_test/java'
        resources.srcDir 'src/integ_test/resources'

        compileClasspath = sourceSets.main.output + sourceSets.test.output + configurations.testRuntime
        runtimeClasspath = output + compileClasspath
    }
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

tasks.withType(JavaCompile) {
    options.compilerArgs += [ '-Xlint:all' ]
    options.incremental = true
    options.encoding = 'UTF-8'
}

jar {
    manifest {
        attributes 'Main-Class': mainClassName, 'TripleA-Version': version
    }
}

repositories {
    jcenter()

    flatDir {
        dirs '/usr/share/java/'
    }
}

dependencies {
//    errorprone 'com.google.errorprone:error_prone_core:2.0.5'
    compile 'commons-io:commons-io:2.5'
    compile 'postgresql:postgresql:9.1-901-1.jdbc4'
    compile 'com.google.code.findbugs:jsr305:3.0.2'
    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 'commons-io:commons-io:2.5'
    compile 'org.apache.httpcomponents:httpclient:4.5.3'
    compile 'org.apache.httpcomponents:httpmime:4.5.3'
    compile 'org.apache.commons:commons-math3:3.6.1'
    compile 'org.mindrot:jbcrypt:0.4'
    compile 'org.yaml:snakeyaml:1.17'
    compile 'org.json:json:20160810'
    compile 'com.yuvimasory:orange-extensions:1.3.0'

    compile name: 'substance'
    compile name: 'trident'
    compile name: 'javafx-fxml'
    compile name: 'javafx-base'
    compile name: 'javafx-controls'
    compile name: 'javafx-graphics'

    testCompile 'eu.codearte.catch-exception:catch-exception:2.0.0-ALPHA-1'
    testCompile 'nl.jqno.equalsverifier:equalsverifier:2.3'
    testCompile 'org.hamcrest:java-hamcrest:2.0.0.0'
    testCompile 'org.mockito:mockito-core:2.8.47'
    testCompile 'junit:junit:4.12'
}

test {
    exclude '**/*Tests.class'
}


/*task integTest(type: Test) {
    group = LifecycleBasePlugin.VERIFICATION_GROUP
    description = 'Runs the integration tests.'

    testClassesDirs = sourceSets.integTest.output.classesDirs
    classpath = sourceSets.integTest.runtimeClasspath

    binResultsDir = file("$buildDir/integration_test_results/binary/integTest")

    reports {
        reports.html.destination = file("${reports.html.destination}/$name")
        reports.junitXml.destination = file("${reports.junitXml.destination}/$name")
    }

    mustRunAfter tasks.test
}*/

task validateYamls(group: 'verification', description: 'Validates YAML files.') {
    doLast {
        def lobbyServerYamlFile = file('lobby_server.yaml')
        validateYaml(lobbyServerYamlFile, file("$schemasDir/lobby_server.json"))

        def mapsYamlFile = file('triplea_maps.yaml')
        validateYaml(mapsYamlFile, file("$schemasDir/triplea_maps.json"))
        validateMapsYamlUris(mapsYamlFile)
    }
}

task prepareGameEngineProperties() {
    group = 'release'
    description = 'Updates the game engine properties with final values for distribution.'

    doLast {
        copy {
            from gameEnginePropertiesFile
            into gameEnginePropertiesArtifactFile.parent
        }
        ant.propertyfile(file: gameEnginePropertiesArtifactFile) {
            entry key: 'engine_version', value: version
        }
    }
}

task allPlatform(type: Zip, group: 'release', dependsOn: [prepareGameEngineProperties]) {
    classifier 'all_platforms'
    ['assets', 'dice_servers'].each { folder ->
        from(folder) {
            into(folder)
        }
    }
    from(gameEnginePropertiesArtifactFile)
}

task generateZipReleases(group: 'release', dependsOn: [allPlatform]) {}

task prepareArtifacts(group: 'release', dependsOn: [generateZipReleases]) {
    doLast {
        def artifacts = [
            file("$libsDir/triplea-$version-all.jar"),
            file("$distsDir/triplea-$version-all_platforms.zip"),
            file("$distsDir/triplea-$version-server.zip"),
            file("$releasesDir/TripleA_${version}_macos.dmg"),
            file("$releasesDir/TripleA_${version}_unix.sh"),
            file("$releasesDir/TripleA_${version}_windows-32bit.exe"),
            file("$releasesDir/TripleA_${version}_windows-64bit.exe")
        ]
        artifacts.each {
            if (!it.exists()) {
                throw new GradleException("artifact '$it' does not exist")
            }
        }

        copy {
            from artifacts
            into artifactsDir
        }
    }
}

task release(group: 'release', dependsOn: [prepareArtifacts]) {}

tasks.withType(Test) {
    testLogging {
        exceptionFormat = 'full'
    }
}

/*check {
    dependsOn 'integTest', 'validateYamls'
}*/