-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
152 lines (128 loc) · 4.38 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
152 lines (128 loc) · 4.38 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
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
/*
* Copyright 2025, xyzsd (Zach Del)
*
* Licensed under either of:
*
* Apache License, Version 2.0
* (see LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license
* (see LICENSE-MIT) or http://opensource.org/licenses/MIT)
*
* at your option.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import com.vanniktech.maven.publish.JavaLibrary
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.SonatypeHost
plugins {
id("java-library")
id("com.vanniktech.maven.publish") version "0.31.0"
id("signing")
}
group = "net.xyzsd"
version = "1.1"
// versions ending with "-SNAPSHOT" will end up at:
// https://central.sonatype.com/service/rest/repository/browse/maven-snapshots/net/xyzsd/dichotomy/
//
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
api("org.jspecify:jspecify:1.0.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.3")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.3")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
vendor.set(JvmVendorSpec.ADOPTIUM)
}
// withJavadocJar()
// withSourcesJar()
}
tasks.compileJava {
options.setEncoding("UTF-8")
options.compilerArgs.add("-Xlint:preview")
options.compilerArgs.add("-Xlint:unchecked")
}
tasks.test {
useJUnitPlatform()
}
tasks.javadoc {
val javadocOptions = options as CoreJavadocOptions
//javadocOptions.addBooleanOption("-enable-preview", true)
javadocOptions.addStringOption("source", "21")
javadocOptions.addStringOption("Xdoclint:none", "-quiet") // for sanity
javadocOptions.addBooleanOption("html5", true)
}
// for reproducible builds
tasks.jar {
setPreserveFileTimestamps(false)
setReproducibleFileOrder(true)
}
// secrets: see
// https://vanniktech.github.io/gradle-maven-publish-plugin/central/#secrets
//
// properties (local)
// ==================
// mavenCentralUsername=[generated username (token)]
// mavenCentralPassword=[token password, also generated]
//
// environmental (local or, say, Github)
// =====================================
// ORG_GRADLE_PROJECT_mavenCentralUsername=[generated username (token)]
// ORG_GRADLE_PROJECT_mavenCentralPassword=[token password, also generated]
//
mavenPublishing {
configure(JavaLibrary(JavadocJar.Javadoc(), true))
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
signAllPublications()
pom {
coordinates("net.xyzsd", "dichotomy", version as String)
name.set("dichotomy")
description.set("Result, Try, Maybe, and Either monads for Java")
url.set("https://maven.pkg.github.com/xyzsd/dichotomy")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
comments.set("A business-friendly OSS license")
}
license {
name.set("The MIT License")
url.set("http://opensource.org/licenses/MIT")
comments.set("A GPL/LGPL compatible OSS license")
}
}
developers {
developer {
id.set("xyzsd")
name.set("Zach Del")
email.set("xyzsd@xyzsd.net")
}
}
scm {
connection.set("scm:git:git://github.com/xyzsd/dichotomy.git")
developerConnection.set("scm:git:ssh://git@github.com:xyzsd/dichotomy.git")
url.set("https://github.com/xyzsd/dichotomy")
}
}
}
signing {
val githubCI: Boolean = "true".equals(System.getenv("CI")) || false
if (githubCI) {
project.logger.lifecycle("Signing: Using Github environment.")
val signingKey: String? = System.getenv("SIGNING_KEY_PRIVATE")
val signingKeyPassphrase: String? = System.getenv("SIGNING_KEY_PASSPHRASE")
useInMemoryPgpKeys(signingKey, signingKeyPassphrase)
} else {
project.logger.lifecycle("Signing: Using local credentials.")
}
}