-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
119 lines (94 loc) · 2.88 KB
/
build.gradle.kts
File metadata and controls
119 lines (94 loc) · 2.88 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
plugins {
id("maven-publish")
id("java")
}
group = "com.tcoded"
allprojects {
apply(plugin = "java")
version = "0.5.2"
repositories {
mavenCentral()
maven {
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
}
maven {
url = uri("https://hub.spigotmc.org/nexus/content/repositories/public/")
}
maven {
url = uri("https://repo.papermc.io/repository/maven-public/")
}
maven {
url = uri("https://nexuslite.gcnt.net/repos/paper/")
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
dependencies {
implementation("org.jetbrains:annotations:23.0.0")
testImplementation(platform("org.junit:junit-bom:5.9.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
}
tasks.test {
useJUnitPlatform()
}
tasks.compileJava {
dependsOn(tasks.clean)
}
}
subprojects.forEach { subproject ->
evaluationDependsOn(subproject.path)
}
tasks.register<Jar>("allJar") {
dependsOn(tasks.clean)
dependsOn(subprojects.map { it.tasks.clean })
dependsOn(tasks.compileJava)
dependsOn(tasks.jar)
dependsOn(subprojects.map { it.tasks.build })
subprojects.forEach { subproject ->
from(subproject.tasks.jar.get().outputs.files.map {
zipTree(it)
})
}
}
val allJar: Task = tasks.named("allJar").get();
artifacts {
add("archives", allJar)
}
publishing {
publications {
create<MavenPublication>("mavenJavaLocal") {
artifact(allJar.outputs.files.singleFile)
}
}
}
tasks.named("generateMetadataFileForMavenJavaLocalPublication") {
dependsOn(allJar)
}
val enablePublishing: Boolean = project.findProperty("enableUploadPublish")?.toString()?.toBoolean() == true
if (enablePublishing) {
publishing {
repositories {
maven {
name = "reposilite"
url = uri("https://repo.tcoded.com/releases")
credentials {
username = project.findProperty("REPOSILITE_USER")?.toString()
?: System.getenv("REPOSILITE_USER")
?: error("REPOSILITE_USER property or environment variable is not set")
password = project.findProperty("REPOSILITE_PASS")?.toString()
?: System.getenv("REPOSILITE_PASS")
?: error("REPOSILITE_PASS property or environment variable is not set")
}
authentication {
register<BasicAuthentication>("basic")
}
}
}
}
tasks.named("publishMavenJavaLocalPublicationToReposiliteRepository") {
dependsOn(tasks.jar)
dependsOn(allJar)
}
}