-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
186 lines (161 loc) · 5.96 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
`java-library`
`maven-publish`
signing
jacoco
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
}
description = "Dependency Injector|Parent"
allprojects {
apply(plugin = "java-library")
apply(plugin = "jacoco")
apply(plugin = "signing")
apply(plugin = "maven-publish")
group = "org.panda-lang.utilities"
version = "1.8.0"
repositories {
mavenCentral()
maven {
name = "reposilite-releases"
url = uri("https://maven.reposilite.com/releases")
}
}
publishing {
repositories {
maven {
name = "reposilite"
url = uri("https://maven.reposilite.com/${if (version.toString().endsWith("-SNAPSHOT")) "snapshots" else "releases"}")
credentials {
username = getEnvOrProperty("MAVEN_NAME", "mavenUser")
password = getEnvOrProperty("MAVEN_TOKEN", "mavenPassword")
}
}
}
}
afterEvaluate {
description
?.takeIf { it.isNotEmpty() }
?.split("|")
?.let { (projectName, projectDescription) ->
publishing {
publications {
create<MavenPublication>("library") {
pom {
name.set(projectName)
description.set(projectDescription)
url.set("https://github.com/FunnyGuilds/dependency-injector")
licenses {
license {
name.set("The MIT License")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("dzikoysk")
name.set("dzikoysk")
email.set("[email protected]")
}
developer {
id.set("peridot")
name.set("Peridot")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/FunnyGuilds/dependency-injector.git")
developerConnection.set("scm:git:ssh://github.com/FunnyGuilds/dependency-injector.git")
url.set("https://github.com/FunnyGuilds/dependency-injector.git")
}
}
from(components.getByName("java"))
}
}
}
if (findProperty("signing.keyId").takeIf { it?.toString()?.trim()?.isNotEmpty() == true } != null) {
signing {
sign(publishing.publications.getByName("library"))
}
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.jacocoTestReport {
dependsOn(tasks.test)
reports {
xml.required.set(true)
html.required.set(true)
}
}
tasks.check {
finalizedBy(tasks.named<JacocoReport>("jacocoTestReport"))
}
tasks.withType<Javadoc> {
(options as StandardJavadocDocletOptions).let {
it.addStringOption("Xdoclint:none", "-quiet") // mute warnings
it.links(
"https://javadoc.io/doc/org.jetbrains/annotations/24.0.1/",
"https://javadoc.io/doc/org.panda-lang/panda-utilities/0.5.3-alpha/",
"https://javadoc.io/doc/org.panda-lang/expressible/1.3.5/"
)
it.encoding = "UTF-8"
}
}
}
subprojects {
dependencies {
// General
api("org.panda-lang:panda-utilities:0.5.3-alpha")
api("org.panda-lang:expressible:1.3.6")
compileOnly("org.jetbrains:annotations:24.1.0")
// Tests
val junit = "5.11.0"
testImplementation("org.junit.jupiter:junit-jupiter-api:$junit")
testImplementation("org.junit.jupiter:junit-jupiter-engine:$junit")
}
java {
withJavadocJar()
withSourcesJar()
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events(TestLogEvent.STARTED, TestLogEvent.PASSED, TestLogEvent.FAILED, TestLogEvent.SKIPPED)
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
showCauses = true
showStackTraces = true
showStandardStreams = true
}
}
tasks.register("release") {
dependsOn(
"publishAllPublicationsToReposiliteRepository",
"publishToSonatype",
)
}
}
tasks.register("release") {
dependsOn(
"clean", "build",
"publishAllPublicationsToReposiliteRepository",
"publishAllPublicationsToSonatypeRepository",
"closeAndReleaseSonatypeStagingRepository"
)
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
username.set(getEnvOrProperty("SONATYPE_USER", "sonatypeUser"))
password.set(getEnvOrProperty("SONATYPE_PASSWORD", "sonatypePassword"))
}
}
}
fun getEnvOrProperty(env: String, property: String): String? =
System.getenv(env) ?: findProperty(property)?.toString()