-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
168 lines (148 loc) · 5.25 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
plugins {
id "java"
id "jacoco"
id "com.palantir.git-version" version "3.0.0"
id "com.diffplug.spotless" version "6.25.0"
}
version = "3.3.0"
sourceCompatibility = 1.11
repositories {
mavenCentral()
}
sourceSets {
main {
java { srcDirs "src/" }
resources { srcDirs "src/" }
}
test {
java { srcDirs "test/" }
resources { srcDirs "test/" }
}
}
dependencies {
implementation "fr.irit.smac.thirdparty.edu.gmu.cs:mason:18"
implementation "com.formdev:flatlaf:0.36"
implementation "com.google.code.gson:gson:2.8.6"
runtimeOnly group: "javax.media", name: "jmf", version: "2.1.1e"
testImplementation "org.mockito:mockito-core:5.14.+"
testImplementation "org.mockito:mockito-inline:5.2.+"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.11.2"
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.11.2"
testImplementation "commons-io:commons-io:2.8.0"
}
test {
useJUnitPlatform()
}
javadoc {
source = sourceSets.main.allJava
classpath = configurations.compileClasspath
destinationDir = file("docs/javadoc")
title = ""
options.memberLevel = JavadocMemberLevel.PRIVATE
options.setNoTimestamp(true)
options.setVersion(true)
options.setNoDeprecated(true)
options.setSplitIndex(true)
}
jacocoTestReport {
afterEvaluate {
classDirectories.from = files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"arcade/core/gui/*",
"arcade/*/vis/*",
])
})
}
reports {
xml.enabled true
html.enabled true
}
}
spotless {
java {
removeUnusedImports()
googleJavaFormat().aosp()
.reorderImports(true)
.formatJavadoc(true)
importOrder('java|javax|org|com||sim|ec|arcade.core|arcade|\\#java|\\#org|\\#|\\#arcade.core|\\#arcade')
indentWithSpaces()
}
format 'misc', {
target '**/.gitignore', '**/*.gradle', '**/*.md', 'src/**/*.xml', 'test/**/*.xml'
indentWithSpaces()
trimTrailingWhitespace()
endWithNewline()
}
}
jar {
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
duplicatesStrategy = DuplicatesStrategy.INCLUDE
archiveFileName.set("${project.name}-${gitVersion().substring(1)}.jar")
manifest {
attributes["Main-Class"] = "arcade.core.gui.GUI"
attributes["Specification-Version"] = project.version
attributes["Implementation-Version"] = gitVersion().substring(1)
}
}
task copyJar(type: Copy) {
from jar
into project.projectDir
doLast {
println "\nBuild the Docker image using:"
println "\ndocker build --build-arg VERSION=${gitVersion().substring(1)} -t arcade:${gitVersion().substring(1)} ."
}
}
task showVersion (group: "versioning", description: "Display version information") {
doLast {
def versionFile = file("version.properties")
Properties versionProperties = new Properties()
versionFile.withInputStream { stream -> versionProperties.load(stream) }
println "Version: ${versionProperties.major}.${versionProperties.minor}.${versionProperties.patch}"
println "Full version: ${gitVersion()}"
}
}
task bumpMajor(group: "versioning", description: "Bump to next major version") {
doFirst {
def versionFile = file("version.properties")
ant.propertyfile(file: versionFile) {
entry(key: "major", type: "int", operation: "+", value: 1)
entry(key: "minor", type: "int", operation: "=", value: 0)
entry(key: "patch", type: "int", operation: "=", value: 0)
}
}
}
task bumpMinor(group: "versioning", description: "Bump to next minor version") {
doFirst {
def versionFile = file("version.properties")
ant.propertyfile(file: versionFile) {
entry(key: "major", type: "int", operation: "+", value: 0)
entry(key: "minor", type: "int", operation: "+", value: 1)
entry(key: "patch", type: "int", operation: "=", value: 0)
}
}
}
task bumpPatch(group: "versioning", description: "Bump to next patch version") {
doFirst {
def versionFile = file("version.properties")
ant.propertyfile(file: versionFile) {
entry(key: "major", type: "int", operation: "+", value: 0)
entry(key: "minor", type: "int", operation: "+", value: 0)
entry(key: "patch", type: "int", operation: "+", value: 1)
}
}
}
task updateVersion (group: "versioning", description: "Syncs gradle version with properties") {
doLast {
def versionFile = file("version.properties")
Properties versionProperties = new Properties()
versionFile.withInputStream { stream -> versionProperties.load(stream) }
String newVersion = "${versionProperties.major}.${versionProperties.minor}.${versionProperties.patch}"
buildFile.setText(buildFile.getText().replaceFirst("""version = "$version""", """version = "$newVersion"""))
println "Bumped version to: ${newVersion}"
}
}
build.dependsOn copyJar
test.finalizedBy jacocoTestReport
bumpMajor.finalizedBy updateVersion
bumpMinor.finalizedBy updateVersion
bumpPatch.finalizedBy updateVersion