-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle.kts
67 lines (53 loc) · 1.96 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
plugins {
java
}
/*
Setup environment variables
* stsInstallLocation should point to the Steam install directory
* compileOnlyLibs should point to a directory containing any JARs you reference
- e.g. this directory should have desktop-1.0.jar, ModTheSpire.jar, BaseMod.jar
- NOTE: these compileOnlyLibs are not included in the JAR, so you will get runtime
errors if you try and call code that won't exist on the client.
*/
var stsInstallLocation: String = System.getenv("STS_INSTALL")
var compileOnlyLibs: String = System.getenv("STS_MODDING_LIB")
// Uses the value written in settings.gradle
var modName: String = rootProject.name
repositories {
mavenCentral()
}
dependencies {
compileOnly(fileTree(compileOnlyLibs))
//compileOnly("io.github.casey-c:easel:0.0.1")
// Tests
testImplementation(fileTree(compileOnlyLibs))
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.0-M1")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.8.0-M1")
}
// --------------------------------------------------------------------------------
tasks.register<Jar>("buildJAR") {
group = "Slay the Spire"
description = "Builds a fat (includes runtime dependencies) JAR in the build/libs folder"
// Main code
from(sourceSets.main.get().output)
// Any runtime dependencies (e.g. from mavenCentral(), local JARs, etc.)
dependsOn(configurations.runtimeClasspath)
from({
configurations.runtimeClasspath.get().filter {
it.name.endsWith("jar")
}.map {
zipTree(it)
}
})
}
tasks.register<Copy>("buildAndCopyJAR") {
group = "Slay the Spire"
description = "Copies the JAR from your build/libs folder into your \$STS_INSTALL location"
dependsOn("buildJAR")
from("build/libs/$modName.jar")
into("$stsInstallLocation\\mods")
}
tasks.withType<Test> {
useJUnitPlatform()
}
// --------------------------------------------------------------------------------