forked from xyzsd/dichotomy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
134 lines (106 loc) · 3.69 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
// see:
// https://docs.github.com/en/actions/publishing-packages/publishing-java-packages-with-gradle
// https://docs.gradle.org/current/userguide/publishing_maven.html
plugins {
id("java-library")
id("maven-publish")
signing
}
group = "net.xyzsd"
version = "1.0"
repositories {
mavenCentral()
}
dependencies {
compileOnly("org.jetbrains:annotations:24.0.1")
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.getByName<Test>("test") {
useJUnitPlatform()
}
tasks.withType<JavaCompile>().configureEach {
options.compilerArgs.add("-Xlint:preview")
options.compilerArgs.add("-Xlint:unchecked")
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
}
tasks.withType<JavaExec>().configureEach {
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
pom {
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:https://www.apache.org/licenses/LICENSE-2.0.txt")
}
license {
name.set("The MIT License")
url.set("http:https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("xyzsd")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git:https://github.com/xyzsd/dichotomy.git")
developerConnection.set("scm:git:ssh:https://[email protected]:xyzsd/dichotomy.git")
url.set("https://github.com/xyzsd/dichotomy")
}
}
}
}
repositories {
maven {
name = "OSSRH"
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_PASSWORD")
}
}
}
}
signing {
val signingKey: String? = System.getenv("SIGNING_KEY_PRIVATE")
val signingKeyPassphrase: String? = System.getenv("SIGNING_KEY_PASSPHRASE")
useInMemoryPgpKeys(signingKey, signingKeyPassphrase)
sign(publishing.publications["mavenJava"])
}
// JavaDoc options
tasks.javadoc {
if (JavaVersion.current().isJava9Compatible) {
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
}
val javadocOptions = options as CoreJavadocOptions
javadocOptions.addStringOption("source", "21")
}
// for reproducible builds
tasks.withType<AbstractArchiveTask>().configureEach {
isReproducibleFileOrder = true
isPreserveFileTimestamps = false
dirMode = 775
fileMode = 664
archiveVersion.set("${project.version}")
}