-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle.kts
128 lines (111 loc) · 4.43 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
fun properties(key: String) = project.findProperty(key).toString()
plugins {
`java-library`
signing
`maven-publish`
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
}
allprojects {
group = properties("group")
version = properties("version")
apply(plugin = "java-library")
apply(plugin = "signing")
apply(plugin = "maven-publish")
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.1")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.9.1")
testImplementation("org.assertj:assertj-core:2.4.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.1")
}
tasks {
val sourcesJar by creating(Jar::class) {
group = "build"
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}
val testsJar by creating(Jar::class) {
dependsOn(JavaPlugin.TEST_CLASSES_TASK_NAME)
group = "build"
archiveClassifier.set("tests")
from(sourceSets["test"].output)
}
val javadocJar by creating(Jar::class) {
dependsOn(JavaPlugin.JAVADOC_TASK_NAME)
group = "build"
archiveClassifier.set("javadoc")
from(getByPath(JavaPlugin.JAVADOC_TASK_NAME).outputs)
}
artifacts {
add("archives", sourcesJar)
add("archives", testsJar)
add("archives", javadocJar)
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
publishing {
publications {
create<MavenPublication>(project.name) {
from(components["java"])
setArtifacts(configurations.archives.get().allArtifacts)
artifactId = project.parent?.let { "${it.name}-${project.name}" } ?: project.name
pom {
// Set name on project base
description.set("This Java/Kotlin library provides an intuitive API for converting strings between different text cases. It has a wide range of built-in support for the most common text cases. In addition, the library is designed to be easily extended with new custom text cases, making it highly flexible and adaptable.")
url.set("https://github.com/marcelkliemannel/text-case-converter")
developers {
developer {
name.set("Marcel Kliemannel")
id.set("marcelkliemannel")
email.set("[email protected]")
}
}
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0")
}
}
issueManagement {
system.set("GitHub")
url.set("https://github.com/marcelkliemannel/text-case-converter/issues")
}
scm {
connection.set("scm:git:git://github.com:marcelkliemannel/text-case-converter.git")
developerConnection.set("scm:git:ssh://github.com:marcelkliemannel/text-case-converter.git")
url.set("https://github.com/marcelkliemannel/text-case-converter")
}
}
}
}
}
/**
* See https://docs.gradle.org/current/userguide/signing_plugin.html#sec:signatory_credentials
*
* The following Gradle properties must be set:
* - signing.keyId (last eight symbols of the key ID from 'gpg -K')
* - signing.password
* - signing.secretKeyRingFile ('gpg --keyring secring.gpg --export-secret-keys > ~/.gnupg/secring.gpg')
*/
signing {
sign(publishing.publications[project.name])
}
}
nexusPublishing {
repositories {
sonatype {
username.set(properties("sonar.username"))
password.set(properties("sonar.password"))
}
}
}
publishing.publications.getByName<MavenPublication>(project.name).pom.name.set("Text Case Converter")