forked from emichael/dslabs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
237 lines (203 loc) · 8.04 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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'com.github.jk1.dependency-license-report' version '2.5'
id 'com.diffplug.spotless' version '6.24.0'
}
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.github.jk1.license.render.TextReportRenderer
java {
sourceCompatibility = '17'
targetCompatibility = '17'
}
sourceSets {
main {
java {
srcDirs = ['framework/src']
}
}
grader {
java {
srcDirs = ['framework/tst']
}
resources {
srcDirs = ['framework/tst']
includes = ['**/*.properties']
}
compileClasspath += main.compileClasspath + main.output
annotationProcessorPath += main.annotationProcessorPath
}
labs {
java {
srcDirs = [ 'labs/lab0-pingpong/src',
'labs/lab1-clientserver/src',
'labs/lab2-primarybackup/src',
'labs/lab3-paxos/src',
'labs/lab4-shardedstore/src' ]
}
compileClasspath += main.compileClasspath + main.output
annotationProcessorPath += main.annotationProcessorPath
}
labsTests {
java {
srcDirs = [ 'labs/lab0-pingpong/tst',
'labs/lab1-clientserver/tst',
'labs/lab2-primarybackup/tst',
'labs/lab3-paxos/tst',
'labs/lab4-shardedstore/tst']
}
compileClasspath += grader.compileClasspath + grader.output + labs.output
annotationProcessorPath += grader.annotationProcessorPath
}
test {
java {
srcDirs = ['framework/tst-self']
}
compileClasspath += grader.compileClasspath + grader.output
runtimeClasspath += grader.runtimeClasspath + labs.runtimeClasspath + labsTests.runtimeClasspath
annotationProcessorPath += grader.annotationProcessorPath
}
}
configurations {
sources {
transitive = false
}
graderImplementation
graderSources {
transitive = false
}
// Unused configuration, necessary to include google-java-format in license
// report
formatter
}
repositories {
mavenCentral()
}
dependencies {
implementation group: 'org.projectlombok', name: 'lombok', version: '1.18.30'
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.30'
sources group: 'org.projectlombok', name: 'lombok', version: '1.18.30', classifier: 'sources'
implementation group: 'com.google.guava', name: 'guava', version: '33.0.0-jre'
sources group: 'com.google.guava', name: 'guava', version: '33.0.0-jre', classifier: 'sources'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.14.0'
sources group: 'org.apache.commons', name: 'commons-lang3', version: '3.14.0', classifier: 'sources'
graderImplementation group: 'junit', name: 'junit', version: '4.13.2'
graderSources group: 'junit', name: 'junit', version: '4.13.2', classifier: 'sources'
graderImplementation group: 'io.github.kostaskougios', name: 'cloning', version: '1.10.3'
graderSources group: 'io.github.kostaskougios', name: 'cloning', version: '1.10.3', classifier: 'sources'
graderImplementation group: 'commons-cli', name: 'commons-cli', version: '1.6.0'
graderSources group: 'commons-cli', name: 'commons-cli', version: '1.6.0', classifier: 'sources'
graderImplementation group: 'commons-io', name: 'commons-io', version: '2.15.1'
graderSources group: 'commons-io', name: 'commons-io', version: '2.15.1', classifier: 'sources'
graderImplementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.15.2'
graderSources group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.15.2', classifier: 'sources'
graderImplementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.15.2'
graderImplementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jdk8', version: '2.15.2'
// Swing stuff
graderImplementation group: 'com.formdev', name: 'flatlaf', version: '3.3'
graderImplementation group: 'com.formdev', name: 'flatlaf', version: '3.3', classifier: 'sources'
graderImplementation group: 'com.formdev', name: 'flatlaf-swingx', version: '3.3'
graderImplementation group: 'com.formdev', name: 'flatlaf-swingx', version: '3.3', classifier: 'sources'
graderImplementation group: 'com.github.jiconfont', name: 'jiconfont-font_awesome', version: '4.7.0.1'
graderImplementation group: 'com.github.jiconfont', name: 'jiconfont-font_awesome', version: '4.7.0.1', classifier: 'sources'
graderImplementation group: 'com.github.jiconfont', name: 'jiconfont-swing', version: '1.0.1'
graderImplementation group: 'com.github.jiconfont', name: 'jiconfont-swing', version: '1.0.1', classifier: 'sources'
graderImplementation group: 'com.miglayout', name: 'miglayout-swing', version: '11.3'
graderImplementation group: 'com.miglayout', name: 'miglayout-swing', version: '11.3', classifier: 'sources'
graderImplementation group: 'org.swinglabs.swingx', name: 'swingx-core', version: '1.6.5-1'
graderImplementation group: 'org.swinglabs.swingx', name: 'swingx-core', version: '1.6.5-1', classifier: 'sources'
formatter group:'com.google.googlejavaformat', name: 'google-java-format', version: '1.19.2'
}
// Create reproducible jars
tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
}
task scaffoldingJar(type: ShadowJar) {
archiveBaseName = 'framework'
from sourceSets.main.output
}
task graderJar(type: ShadowJar) {
archiveBaseName = 'grader'
from sourceSets.grader.output
}
task scaffoldingSourcesJar(type: ShadowJar) {
archiveBaseName = 'framework'
archiveClassifier = 'sources'
from sourceSets.main.java
}
task graderSourcesJar(type: ShadowJar) {
archiveBaseName = 'grader'
archiveClassifier = 'sources'
from sourceSets.grader.java
}
task scaffoldingDependenciesJar(type: ShadowJar) {
archiveBaseName = 'framework'
archiveClassifier = 'deps'
configurations = [ project.configurations.runtimeClasspath ]
}
task graderDependenciesJar(type: ShadowJar) {
archiveBaseName = 'grader'
archiveClassifier = 'deps'
configurations = [ project.configurations.graderRuntimeClasspath ]
}
task scaffoldingDependenciesSourcesJar(type: ShadowJar) {
archiveBaseName = 'framework'
archiveClassifier = 'deps-sources'
configurations = [ project.configurations.sources ]
}
jar.enabled = false
javadoc {
title = 'Distributed Systems Labs Framework'
destinationDir = file("$buildDir/doc")
options.noTimestamp(true)
options.noIndex(true)
options.noDeprecatedList(true)
options.noHelp(true)
options.setOutputLevel(JavadocOutputLevel.QUIET)
}
tasks.assemble.dependsOn tasks.scaffoldingJar
tasks.assemble.dependsOn tasks.graderJar
tasks.assemble.dependsOn tasks.scaffoldingSourcesJar
tasks.assemble.dependsOn tasks.graderSourcesJar
tasks.assemble.dependsOn tasks.scaffoldingDependenciesJar
tasks.assemble.dependsOn tasks.graderDependenciesJar
tasks.assemble.dependsOn tasks.scaffoldingDependenciesSourcesJar
// copy dependencies into directories that IntelliJ can find
task copyDependencies {
doLast {
copy {
from configurations.runtimeClasspath,
configurations.sources
into "deps/compile"
}
copy {
from configurations.graderRuntimeClasspath,
configurations.graderSources
into "deps/test"
}
}
}
// Put gradle wrapper in a hidden folder
wrapper {
jarFile = file('.gradle-wrapper/gradle-wrapper.jar')
}
// Run tests with illegal-access=deny to ensure that these warnings are caught
test.jvmArgs(['-ea',
'--add-opens', 'java.base/jdk.internal.reflect=ALL-UNNAMED',
'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
'--add-opens', 'java.base/java.util=ALL-UNNAMED',
'--add-opens','java.base/java.util.concurrent.atomic=ALL-UNNAMED'])
licenseReport {
configurations = ALL
outputDir = "${project.buildDir}/reports/licenses"
renderers = [ new TextReportRenderer() ]
}
// Spotless auto-formatter config
spotless {
java {
removeUnusedImports()
cleanthat()
googleJavaFormat()
}
}