-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
94 lines (77 loc) · 2.96 KB
/
Copy pathbuild.gradle
File metadata and controls
94 lines (77 loc) · 2.96 KB
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
plugins {
id "java"
}
group = "net.danh"
version = "1.8.2"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.release = 21
}
dependencies {
compileOnly "io.papermc.paper:paper-api:1.21.11-R0.1-SNAPSHOT"
compileOnly "net.Indyuce:MMOItems-API:6.10.1-SNAPSHOT"
compileOnly "io.lumine:MythicLib-dist:1.7.1-SNAPSHOT"
compileOnly "io.lumine:Mythic-Dist:5.12.0"
compileOnly "me.clip:placeholderapi:2.12.2"
compileOnly "com.nexomc:nexo:1.23"
compileOnly "io.th0rgal:oraxen:1.213.0"
compileOnly files("libs/ItemEdit.jar")
compileOnly "com.github.LoneDev6:API-ItemsAdder:3.6.1"
compileOnly files("libs/SCore.jar")
compileOnly "net.kyori:adventure-api:5.1.1"
compileOnly "net.kyori:adventure-text-minimessage:5.1.1"
compileOnly "net.kyori:adventure-text-serializer-plain:5.1.1"
}
processResources {
filteringCharset = "UTF-8"
filesMatching("plugin.yml") {
expand(version: project.version)
}
}
task buildAll {
group = "build"
description = "Builds both Free and Premium versions of StackCraft"
doLast {
def apiFile = file('src/main/java/net/danh/stackcraft/api/SCAPI.java')
def originalText = apiFile.text
def os = System.properties['os.name'].toLowerCase()
def buildCmd = os.contains('windows') ? "cmd /c gradlew.bat clean build" : "sh -c ./gradlew clean build"
// 1. Compile Premium
println "=== Building Premium Version ==="
apiFile.text = originalText.replace('boolean premium = false;', 'boolean premium = true;')
def p1 = buildCmd.execute(null, project.projectDir)
p1.waitForProcessOutput(System.out, System.err)
if (p1.exitValue() != 0) throw new GradleException("Premium build failed")
project.copy {
from "build/libs"
into "jar"
include "StackCraft-${version}.jar"
rename { String fileName ->
fileName.replace(".jar", "-Premium.jar")
}
}
// 2. Compile Free
println "=== Building Free Version ==="
apiFile.text = originalText.replace('boolean premium = true;', 'boolean premium = false;')
def p2 = buildCmd.execute(null, project.projectDir)
p2.waitForProcessOutput(System.out, System.err)
if (p2.exitValue() != 0) throw new GradleException("Free build failed")
project.copy {
from "build/libs"
into "jar"
include "StackCraft-${version}.jar"
rename { String fileName ->
fileName.replace(".jar", "-Free.jar")
}
}
// 3. Revert source
println "=== Cleaning up ==="
apiFile.text = originalText.replace('boolean premium = false;', 'boolean premium = true;')
println "=== Done! Jars are located in the 'jar/' folder! ==="
}
}