-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle.kts
87 lines (74 loc) · 1.98 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
plugins {
alias(libs.plugins.kotlin)
alias(libs.plugins.shadow)
}
val pluginVersion: String by project
fun getCommitID(): String {
val command = if (System.getProperty("os.name").startsWith("Windows")) {
arrayOf("cmd", "/c", "git log --pretty=format:%h -1")
} else {
arrayOf("sh", "-c", "git log --pretty=format:%h -1")
}
val process = ProcessBuilder()
.command(*command)
.start()
return process.inputStream.bufferedReader().readLine()
}
tasks.jar {
enabled = false
}
tasks.register<Copy>("collectJars") {
group = "build"
val outputDir = layout.buildDirectory.dir("libs")
into(outputDir)
subprojects.forEach { subproject ->
dependsOn(subproject.tasks.named("build"))
val jarTask = subproject.tasks.findByName("jar")
if (jarTask != null) {
from(subproject.layout.buildDirectory.dir("libs"))
}
}
}
tasks.build {
dependsOn(tasks.named("collectJars"))
}
subprojects {
group = "cn.rtast"
version = pluginVersion
apply {
plugin("org.jetbrains.kotlin.jvm")
plugin("com.gradleup.shadow")
}
tasks.build {
dependsOn(tasks.shadowJar)
}
tasks.shadowJar {
exclude("com/google/gson/**")
exclude("org/jetbrains/**")
exclude("org/intellij/**")
from("$rootDir/LICENSE")
}
dependencies {
implementation(kotlin("stdlib"))
}
}
allprojects {
repositories {
mavenCentral()
maven {
name = "sonatype"
url = uri("https://oss.sonatype.org/content/groups/public/")
}
maven {
name = "papermc-repo"
url = uri("https://repo.papermc.io/repository/maven-public/")
}
maven {
name = "spigotmc-repo"
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
}
}
base {
archivesName = rootProject.name + "-${project.name}+.${getCommitID()}"
}
}