forked from FancyMcPlugins/FancyNpcs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
142 lines (118 loc) · 4.49 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
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
import java.io.BufferedReader
import java.io.InputStreamReader
plugins {
id("java-library")
id("maven-publish")
id("xyz.jpenilla.run-paper") version "2.2.2"
id("com.github.johnrengelman.shadow") version "8.1.1"
}
runPaper.folia.registerTask()
allprojects {
group = "de.oliver"
version = "2.0.6.1"
description = "Simple, lightweight and fast NPC plugin using packets"
repositories {
mavenLocal()
mavenCentral()
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://repo.fancyplugins.de/releases")
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
maven(url = "https://jitpack.io")
}
}
dependencies {
compileOnly("io.papermc.paper:paper-api:${findProperty("minecraftVersion")}-R0.1-SNAPSHOT")
implementation(project(":api"))
implementation(project(":implementation_1_20_4", configuration = "reobf"))
implementation(project(":implementation_1_20_2", configuration = "reobf"))
implementation(project(":implementation_1_20_1", configuration = "reobf"))
implementation(project(":implementation_1_20", configuration = "reobf"))
implementation(project(":implementation_1_19_4", configuration = "reobf"))
implementation("de.oliver:FancyLib:${findProperty("fancyLibVersion")}")
implementation("com.github.CoolDCB:ChatColorHandler:${findProperty("chatcolorhandlerVersion")}")
compileOnly("me.clip:placeholderapi:${findProperty("placeholderapiVersion")}")
compileOnly("com.intellectualsites.plotsquared:plotsquared-core:${findProperty("plotsquaredVersion")}")
}
tasks {
runServer {
minecraftVersion(findProperty("minecraftVersion").toString())
downloadPlugins {
hangar("ViaVersion", "4.9.3-SNAPSHOT+176")
hangar("ViaBackwards", "4.9.2-SNAPSHOT+104")
hangar("PlaceholderAPI", findProperty("placeholderapiVersion").toString())
}
}
shadowJar {
archiveClassifier.set("")
}
publishing {
repositories {
maven {
name = "fancypluginsReleases"
url = uri("https://repo.fancyplugins.de/releases")
credentials(PasswordCredentials::class)
authentication {
isAllowInsecureProtocol = true
create<BasicAuthentication>("basic")
}
}
maven {
name = "fancypluginsSnapshots"
url = uri("https://repo.fancyplugins.de/snapshots")
credentials(PasswordCredentials::class)
authentication {
isAllowInsecureProtocol = true
create<BasicAuthentication>("basic")
}
}
}
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(project.components["java"])
}
}
}
compileJava {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
// Set the release flag. This configures what version bytecode the compiler will emit, as well as what JDK APIs are usable.
// See https://openjdk.java.net/jeps/247 for more information.
options.release.set(17)
}
javadoc {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
}
processResources {
filteringCharset = Charsets.UTF_8.name() // We want UTF-8 for everything
val props = mapOf(
"description" to project.description,
"version" to project.version,
"hash" to getCurrentCommitHash(),
"build" to (System.getenv("BUILD_ID") ?: "").ifEmpty { "undefined" }
)
inputs.properties(props)
filesMatching("plugin.yml") {
expand(props)
}
filesMatching("version.yml") {
expand(props)
}
}
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
fun getCurrentCommitHash(): String {
val process = ProcessBuilder("git", "rev-parse", "HEAD").start()
val reader = BufferedReader(InputStreamReader(process.inputStream))
val commitHash = reader.readLine()
reader.close()
process.waitFor()
if (process.exitValue() == 0) {
return commitHash ?: ""
} else {
throw IllegalStateException("Failed to retrieve the commit hash.")
}
}