forked from softprops/typeid-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
132 lines (118 loc) · 3.6 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
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java library project to get you started.
* For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
* User Manual available at https://docs.gradle.org/8.1.1/userguide/building_java_projects.html
* This project uses @Incubating APIs which are subject to change.
*/
plugins {
// Apply the java-library plugin for API and implementation separation.
`java-library`
id("com.github.mrsarm.jshell.plugin") version "1.2.1"
id("com.adarshr.test-logger") version "3.2.0"
`maven-publish`
signing
id("io.github.gradle-nexus.publish-plugin").version("1.0.0")
id("me.champeau.jmh") version "0.7.1"
}
// https://central.sonatype.org/publish/publish-guide/#introduction
group = "me.lessis"
version = "0.0.2"
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
tasks.jar {
manifest {
attributes(mapOf("Implementation-Title" to project.name,
"Implementation-Version" to project.version))
}
}
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
artifactId = "typeid"
from(components["java"])
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
pom {
name.set("typeid")
description.set("A TypeID implementation for Java")
url.set("https://github.com/softprops/typeid-java")
licenses {
license {
name.set("MIT")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("softprops")
name.set("Doug Tangren")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:[email protected]:softprops/typeid-java.git")
developerConnection.set("scm:git:[email protected]:softprops/typeid-java.git")
url.set("https://github.com/softprops/typeid-java/")
}
}
}
}
}
signing {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications["mavenJava"])
}
// https://oss.sonatype.org
nexusPublishing {
repositories {
sonatype {
username.set(System.getenv("OSSRH_USER") ?: return@sonatype)
password.set(System.getenv("OSSRH_PASSWORD") ?: return@sonatype)
}
}
}
tasks.withType<Test> {
this.testLogging {
this.showStandardStreams = true
}
}
dependencies {
testImplementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.0")
}
testing {
suites {
// Configure the built-in test suite
val test by getting(JvmTestSuite::class) {
// Use JUnit Jupiter test framework
useJUnitJupiter("5.9.3")
}
}
}
// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
jmh {
warmupIterations.set(3)
iterations.set(2)
threads.set(1)
fork.set(1)
}