This repository has been archived by the owner on Mar 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
119 lines (109 loc) · 3.65 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
plugins {
java
`maven-publish`
signing
}
group = "io.github.teamcheeze"
version = "0.0.5"
allprojects {
apply(plugin = "java")
configurations {
create("shade")
}
}
repositories {
mavenCentral()
}
dependencies {
configurations["shade"](project(":api"))
configurations["shade"](project(":core"))
configurations["shade"]("org.jetbrains:annotations:22.0.0")
configurations["shade"]("io.github.teamcheeze:jaw:1.0.4")
}
tasks {
jar {
subprojects.forEach { project ->
from(project.sourceSets["main"].output)
from(project.configurations["shade"].map { if (it.isDirectory) it else zipTree(it) })
}
}
register<Jar>("sourcesJar") {
archiveClassifier.set("sources")
subprojects.forEach {
from(it.sourceSets["main"].allSource)
}
}
register<Javadoc>("allJavadoc") {
source(subprojects.map { it.sourceSets["main"].allSource })
classpath = files(subprojects.map { it.sourceSets["main"].compileClasspath })
}
register<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
val task = project.tasks["allJavadoc"]
dependsOn(task)
from((task as Javadoc).destinationDir)
}
}
publishing {
publications {
create<MavenPublication>("publication") {
from(components["java"])
artifact(tasks["sourcesJar"])
artifact(tasks["javadocJar"])
repositories {
mavenLocal()
maven {
name = "sonatype"
credentials.runCatching {
val nexusUsername: String by project
val nexusPassword: String by project
username = nexusUsername
password = nexusPassword
}.onFailure {
logger.warn("Failed to load nexus credentials, Check the gradle.properties")
}
url = uri(
if (version.endsWith("-SNAPSHOT") || version.endsWith(".Beta") || version.endsWith(".beta")) {
"https://s01.oss.sonatype.org/content/repositories/snapshots/"
} else {
"https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
}
)
}
}
pom {
name.set("sonet")
description.set("Simple, lightweight network manager.")
url.set("https://github.com/dolphin2410/sonet")
licenses {
license {
name.set("GNU General Public License version 3")
url.set("https://opensource.org/licenses/GPL-3.0")
}
}
developers {
developer {
name.set("dolphin2410")
email.set("[email protected]")
url.set("https://github.com/dolphin2410")
}
}
scm {
connection.set("scm:git:git://github.com/dolphin2410/sonet.git")
developerConnection.set("scm:git:ssh://github.com:dolphin2410/sonet.git")
url.set("https://github.com/dolphin2410/sonet")
}
}
}
}
}
signing {
isRequired = true
sign(tasks["javadocJar"],tasks["sourcesJar"], tasks.jar.get())
sign(publishing.publications["publication"])
}
dependencies {
configurations["shade"].forEach {
implementation(files(it))
}
}