-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
117 lines (107 loc) · 3.08 KB
/
build.gradle.kts
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
import org.sourcegrade.submitter.submit
plugins {
java
application
id("org.sourcegrade.submitter") version "0.4.0"
id("com.github.johnrengelman.shadow") version "7.1.2"
}
version = "0.1.0-SNAPSHOT"
repositories {
mavenCentral()
}
submit {
assignmentId = "sudoku"
studentId = "ab12cdef"
firstName = "sol_first"
lastName = "sol_last"
requireTests = false
}
val grader: SourceSet by sourceSets.creating {
val test = sourceSets.test.get()
compileClasspath += test.output + test.compileClasspath
runtimeClasspath += output + test.runtimeClasspath
}
dependencies {
implementation("org.jetbrains:annotations:23.0.0")
implementation("org.fusesource.jansi:jansi:2.4.0")
"graderCompileOnly"("org.sourcegrade:jagr-launcher:0.4.0") {
exclude("org.jetbrains", "annotations")
}
testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
}
application {
mainClass.set("sudoku.Main")
}
tasks {
val runDir = File("build/run")
named<JavaExec>("run") {
doFirst {
runDir.mkdirs()
}
workingDir = runDir
standardInput = System.`in`
}
test {
doFirst {
runDir.mkdirs()
}
workingDir = runDir
useJUnitPlatform()
}
val graderTest by creating(Test::class) {
group = "verification"
doFirst {
runDir.mkdirs()
}
workingDir = runDir
testClassesDirs = grader.output.classesDirs
classpath = grader.compileClasspath + grader.runtimeClasspath
useJUnitPlatform()
}
named("check") {
dependsOn(graderTest)
}
val graderJar by creating(Jar::class) {
group = "build"
afterEvaluate {
archiveFileName.set("FOP-2022-Sudoku-${project.version}.jar")
from(sourceSets.main.get().allSource)
from(sourceSets.test.get().allSource)
from(grader.allSource)
}
}
val graderLibs by creating(Jar::class) {
group = "build"
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
// don't include Jagr's runtime dependencies
val jagrRuntime = configurations["graderCompileClasspath"]
.resolvedConfiguration
.firstLevelModuleDependencies
.first { it.moduleGroup == "org.sourcegrade" && it.moduleName == "jagr-launcher" }
.allModuleArtifacts
.map { it.file }
val runtimeDeps = grader.runtimeClasspath.mapNotNull {
if (it.path.toLowerCase().contains("sudoku") || jagrRuntime.contains(it)) {
null
} else if (it.isDirectory) {
it
} else {
zipTree(it)
}
}
from(runtimeDeps)
archiveFileName.set("FOP-2022-Sudoku-${project.version}-libs.jar")
}
create("graderAll") {
group = "build"
dependsOn(graderJar, graderLibs)
}
withType<JavaCompile> {
options.encoding = "UTF-8"
sourceCompatibility = "11"
targetCompatibility = "11"
}
jar {
enabled = false
}
}