-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
121 lines (105 loc) · 2.79 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
plugins {
id 'java'
id 'war'
id 'io.franzbecker.gradle-lombok' version '2.1'
id "com.diffplug.gradle.spotless" version "3.18.0"
}
def getVersionName = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'sh', './version.sh'
standardOutput = stdout
}
return stdout.toString().trim()
}
group = 'com.battlesnake'
description = "Battlesnake"
version = getVersionName()
sourceCompatibility = 1.11
targetCompatibility = 1.11
war {
archiveName = rootProject.name + '.war'
doFirst {
manifest {
attributes("Implementation-Title": project.name,
"Implementation-Version": version,
"Implementation-Timestamp": new Date()
)
}
}
}
war.mustRunAfter clean
ext {
gsonVersion = '2.8.5'
junitVersion = '5.4.0'
log4jVersion = '2.11.2'
tomcatVersion = '9.0.16'
webappRunnerVersion = "$tomcatVersion.0"
wsVersion = '2.1'
lombokVersion = '1.18.6'
}
lombok {
version = "$lombokVersion"
sha256 = ""
}
spotless {
java {
target 'src/**/*.java'
importOrder 'java', 'javax', 'org', 'com'
removeUnusedImports()
}
}
repositories {
mavenCentral()
maven {
url "https://artifactory.cronapp.io/public-release/"
}
}
dependencies {
compile "com.google.code.gson:gson:$gsonVersion"
compile "com.google.code.gson:gson-extras:$gsonVersion"
compile "org.apache.tomcat:tomcat-servlet-api:$tomcatVersion"
compile "javax.ws.rs:javax.ws.rs-api:$wsVersion"
compile "org.apache.logging.log4j:log4j-api:$log4jVersion"
compile "org.apache.logging.log4j:log4j-core:$log4jVersion"
compile "org.apache.logging.log4j:log4j-web:$log4jVersion"
providedCompile "com.github.jsimone:webapp-runner:$webappRunnerVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
}
clean.doFirst {
delete "${rootDir}/target"
}
task copyRunner(type: Copy) {
into "$buildDir/server"
from(configurations.compile) {
include "webapp-runner*"
}
}
task stage() {
dependsOn clean, war
}
stage.dependsOn(copyRunner)
task run() {
dependsOn stage
doLast {
exec {
workingDir "$buildDir"
commandLine 'java', '-jar',
"server/webapp-runner-${rootProject.ext.webappRunnerVersion}.jar",
"libs/$war.archiveName"
}
}
}
import io.franzbecker.gradle.lombok.task.DelombokTask
task delombok(type: DelombokTask, dependsOn: compileJava) {
ext.outputDir = file("$buildDir/delombok")
outputs.dir(outputDir)
sourceSets.main.java.srcDirs.each {
inputs.dir(it)
args(it, "-d", outputDir)
}
doFirst {
outputDir.deleteDir()
}
}