forked from SirBlobman/BlueSlimeCore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
77 lines (60 loc) · 2.01 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
val apiVersion = fetchProperty("version.api", "invalid")
rootProject.ext.set("apiVersion", apiVersion)
val mavenUsername = fetchEnv("MAVEN_DEPLOY_USR", "mavenUsernameSirBlobman", "")
rootProject.ext.set("mavenUsername", mavenUsername)
val mavenPassword = fetchEnv("MAVEN_DEPLOY_PSW", "mavenPasswordSirBlobman", "")
rootProject.ext.set("mavenPassword", mavenPassword)
val baseVersion = fetchProperty("version.base", "invalid")
val betaString = fetchProperty("version.beta", "false")
val jenkinsBuildNumber = fetchEnv("BUILD_NUMBER", null, "Unofficial")
val betaBoolean = betaString.toBoolean()
val betaVersion = if (betaBoolean) "Beta-" else ""
val calculatedVersion = "$baseVersion.$betaVersion$jenkinsBuildNumber"
rootProject.ext.set("isBeta", betaBoolean)
rootProject.ext.set("calculatedVersion", calculatedVersion)
fun fetchProperty(propertyName: String, defaultValue: String): String {
val found = findProperty(propertyName)
if (found != null) {
return found.toString()
}
return defaultValue
}
fun fetchEnv(envName: String, propertyName: String?, defaultValue: String): String {
val found = System.getenv(envName)
if (found != null) {
return found
}
if (propertyName != null) {
return fetchProperty(propertyName, defaultValue)
}
return defaultValue
}
plugins {
id("java")
}
tasks.named("jar") {
enabled = false
}
subprojects {
apply(plugin = "java")
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
repositories {
mavenCentral()
}
dependencies {
compileOnly("org.jetbrains:annotations:24.1.0") // JetBrains Annotations
}
tasks {
withType<JavaCompile> {
options.encoding = "UTF-8"
options.compilerArgs.add("-Xlint:deprecation")
}
withType<Javadoc> {
val standard = options as StandardJavadocDocletOptions
standard.addStringOption("Xdoclint:none", "-quiet")
}
}
}