forked from Spireblight/STR-Spire-Mod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts.example
76 lines (59 loc) · 2.05 KB
/
build.gradle.kts.example
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
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 steamappsLocation: String = ""
var stsInstallLocation: String = ""
var workshopLocation: String = "$steamappsLocation/workshop/content/646570"
var modTheSpireLocation: String = "$workshopLocation/1605060445/ModTheSpire.jar"
var baseModLocation: String = "$workshopLocation/1605833019/BaseMod.jar"
var stsJar: String = "$stsInstallLocation/desktop-1.0.jar"
// Uses the value written in settings.gradle
var modName: String = rootProject.name
repositories {
mavenCentral()
}
dependencies {
compileOnly(files(modTheSpireLocation, baseModLocation, stsJar))
}
tasks.register("srcsets") {
doLast {
sourceSets.forEach { srcSet ->
println(srcSet.name)
println(srcSet.allJava.srcDirs)
}
}
}
// --------------------------------------------------------------------------------
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()
}