forked from atextor/turtle-formatter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
160 lines (140 loc) · 4.76 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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
plugins {
java
jacoco
id("com.github.ben-manes.versions") version "0.51.0"
id("com.adarshr.test-logger") version "4.0.0"
id("io.franzbecker.gradle-lombok") version "5.0.0"
`java-library`
`maven-publish`
signing
}
group = "de.atextor"
description = "Library for pretty printing RDF/Turtle documents"
repositories {
mavenCentral()
}
dependencies {
implementation("org.apache.jena:jena-core:4.10.0")
implementation("org.apache.jena:jena-arq:4.10.0")
implementation("org.slf4j:slf4j-api:2.0.12")
compileOnly("org.projectlombok:lombok:1.18.30")
annotationProcessor("org.projectlombok:lombok:1.18.30")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testImplementation("org.assertj:assertj-core:3.25.3")
testImplementation("net.jqwik:jqwik:1.8.3")
testImplementation("org.apache.jena:apache-jena-libs:4.10.0")
testCompileOnly("org.projectlombok:lombok:1.18.30")
testAnnotationProcessor("org.projectlombok:lombok:1.18.30")
testRuntimeOnly ("org.junit.platform:junit-platform-launcher")
}
java {
withJavadocJar()
withSourcesJar()
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}
tasks.named("dependencyUpdates", DependencyUpdatesTask::class.java).configure {
rejectVersionIf {
isNonStable(candidate.version)
}
}
tasks.compileJava {
options.encoding = "UTF-8"
sourceCompatibility = "17"
targetCompatibility = "17"
}
tasks.compileTestJava {
options.encoding = "UTF-8"
sourceCompatibility = "17"
targetCompatibility = "17"
}
tasks.test {
useJUnitPlatform()
ignoreFailures = false
failFast = true
maxHeapSize = "1G"
}
jacoco {
toolVersion = "0.8.12"
}
tasks.jacocoTestReport {
reports {
xml.required.set(true)
html.required.set(true)
html.outputLocation.set(layout.buildDirectory.dir("reports/jacoco/html-report"))
}
}
tasks.javadoc {
(options as CoreJavadocOptions).addStringOption("Xdoclint:accessibility,html,syntax,reference", "-quiet")
options.encoding = "UTF-8"
if (JavaVersion.current().isJava9Compatible) {
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
}
shouldRunAfter(tasks.test)
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
artifactId = "turtle-formatter"
from(components["java"])
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
pom {
name.set("turtle-formatter")
description.set(project.description)
url.set("https://github.com/atextor/turtle-formatter")
licenses {
license {
name.set("Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0")
}
}
developers {
developer {
id.set("atextor")
name.set("Andreas Textor")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/atextor/turtle-formatter.git")
developerConnection.set("scm:git:ssh://github.com:atextor/turtle-formatter.git")
url.set("https://github.com/atextor/turtle-formatter/tree/main")
}
issueManagement {
url.set("https://github.com/atextor/turtle-formatter/issues")
system.set("GitHub")
}
}
}
}
repositories {
maven {
name = "OSSRH"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}
// This configuration will read the signing PGP key and password from environment variables
// ORG_GRADLE_PROJECT_signingKey (in ASCII-armored format) and ORG_GRADLE_PROJECT_signingPassword
signing {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications["mavenJava"])
}