-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
193 lines (155 loc) · 5.29 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
kotlin("jvm")
`maven-publish`
id("com.github.ben-manes.versions")
}
version = "0.3.0-SNAPSHOT"
group = "xyz.chrisime"
description = "CRooD (an easy-to-use CRUD Repository built on jOOQ)"
dependencies {
api(libs.jooq)
compileOnly(libs.bundles.jooq)
implementation(platform(libs.kotlin.bom))
implementation(libs.json)
testImplementation(platform(libs.junit))
testImplementation(libs.bundles.kotest) {
exclude(group = "io.mockk")
}
}
tasks {
compileKotlin {
kotlinOptions {
jvmTarget = "${JavaVersion.VERSION_11}"
apiVersion = "1.5"
languageVersion = "1.5"
freeCompilerArgs = listOf(
"-Xjsr305=strict",
)
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "${JavaVersion.VERSION_11}"
apiVersion = "1.5"
languageVersion = "1.5"
freeCompilerArgs = listOf(
"-Xjsr305=strict",
)
}
}
jar {
metaInf {
from("${rootProject.path}/README.md", "${rootProject.path}/LICENSE")
}
manifest {
attributes(
mapOf(
"Bundle-Description" to rootProject.description,
"Bundle-Copyright" to copyright,
"Build-Jdk-Spec" to jdkSpecVersion,
"Build-Jdk" to jdkBuild,
"Build-OS" to buildOs,
"Bundle-Name" to rootProject.name,
"Bundle-SymbolicName" to artifactName,
"Bundle-Version" to project.version,
"Bundle-License" to pomLicenseUrl,
"Built-By" to builtBy,
"Created-By" to "Gradle ${gradle.gradleVersion}"
)
)
}
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
test {
useJUnitPlatform()
testLogging {
showExceptions = true
showCauses = true
showStackTraces = true
showStandardStreams = true
exceptionFormat = TestExceptionFormat.FULL
displayGranularity = 2
events(TestLogEvent.FAILED, TestLogEvent.SKIPPED, TestLogEvent.PASSED)
}
}
dependencyUpdates {
checkForGradleUpdate = true
outputFormatter = "html" // plain. json, xml
outputDir = "build/dependencyUpdates"
reportfileName = "report"
rejectVersionIf {
isNonStable(candidate.version)
}
}
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}
val username = "chrisime"
val myname = "Christian Meyer"
val myemail = "code@chrisime.xyz"
val copyright = "Copyright (c) 2016-2022"
val githubRepository = "${username}/crood"
val githubReadme = "README.md"
val buildOs = "${System.getProperty("os.name")} ${System.getProperty("os.arch")} ${System.getProperty("os.version")}"
val builtBy = "$myname <${myemail}>"
val jdkSpecVersion = System.getProperty("java.specification.version") as String
val jdkBuild = "${System.getProperty("java.version")} (${System.getProperty("java.vendor")} ${System.getProperty("java.vm.version")})"
val artifactName = project.name.toLowerCase()
val artifactGroup = project.group.toString()
val artifactVersion = project.version.toString()
val pomUrl = "https://github.com/${githubRepository}"
val pomScmUrl = "https://github.com/${githubRepository}"
val pomIssueUrl = "https://github.com/${githubRepository}/issues"
val pomDesc = "https://github.com/${githubRepository}"
val pomLicenseName = "Apache-2.0"
val pomLicenseUrl = "https://opensource.org/licenses/Apache-2.0"
val pomLicenseDist = "repo"
val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.getByName("main").allSource)
}
publishing {
publications {
create<MavenPublication>(artifactName) {
groupId = artifactGroup
artifactId = artifactName
version = artifactVersion
from(components.getByName("java"))
artifact(sourcesJar)
pom {
name.set(artifactName)
description.set(pomDesc)
url.set(pomUrl)
licenses {
name.set(pomLicenseName)
url.set(pomLicenseUrl)
distributionManagement { }
}
developers {
developer {
id.set(username)
name.set(myname)
email.set(myemail)
}
}
contributors { }
scm {
url.set(pomScmUrl)
}
organization { }
issueManagement { }
ciManagement { }
distributionManagement { }
}
}
}
}