-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
98 lines (81 loc) · 3.29 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
98 lines (81 loc) · 3.29 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
95
96
97
98
import io.freefair.gradle.plugins.lombok.LombokPlugin
import org.gradle.api.plugins.JavaPluginExtension
import org.screamingsandals.gradle.builder.*
plugins {
alias(libs.plugins.screaming.plugin.builder) apply(false)
alias(libs.plugins.lombok) apply(false)
}
defaultTasks("clean", "build")
subprojects {
apply<BuilderPlugin>()
repositories {
mavenCentral()
maven("https://libraries.minecraft.net")
maven("https://jitpack.io")
maven("https://repo-new.spongepowered.org/repository/maven-public/")
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://repo.screamingsandals.org/public/")
maven("https://oss.sonatype.org/content/repositories/snapshots/")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven("https://repo.viaversion.com/")
}
if (name.matches(Regex("[a-z]+-[a-z]+")) && !name.endsWith("-common")) {
var foundAnotherModule = false
val platform = name.substringAfter("-")
// modules for NMS based platforms can have shared vanilla modules
if (platform in listOf("bukkit", "sponge")) {
val vanillaProject = rootProject.findProject(":${name.substringBefore("-")}-vanilla")
if (vanillaProject != null) {
dependencies {
"api"(vanillaProject)
}
foundAnotherModule = true
}
}
if (!foundAnotherModule) {
val commonProject = rootProject.findProject(":${name.substringBefore("-")}-common")
if (commonProject != null) {
dependencies {
"api"(commonProject)
}
}
}
}
val onlyPomArtifact = !project.file("src").exists() && !project.file("build.gradle.kts").exists()
if (!onlyPomArtifact) {
apply<JavaPlugin>()
apply<LombokPlugin>()
configureJavac(JavaVersion.VERSION_11)
configureLicenser()
extensions.configure<JavaPluginExtension>("java") {
disableAutoTargetJvm()
}
dependencies {
"compileOnly"(rootProject.libs.jetbrains.annotations)
}
if (name != "nms") {
configureSourcesJar(
// allow every non-test source set to be in sources jar
predicate = { it.name != "test" }
)
}
}
project.afterEvaluate {
// Some subprojects may configure shadowJar later, so we need to postpone this to afterEvaluate
setupMavenPublishing(onlyPomArtifact = onlyPomArtifact, addSourceJar = !onlyPomArtifact && name != "nms") {
pom {
name.set("ScreamingLib")
description.set("Cross-platform library for developing Minecraft: Java Edition server plugins.")
url.set("https://github.com/ScreamingSandals/ScreamingLib")
licenses {
license {
name.set("Apache License 2.0")
url.set("https://github.com/ScreamingSandals/ScreamingLib/blob/ver/2.0.x/LICENSE")
}
}
}
}
}
setupMavenRepositoriesFromProperties()
}