-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
158 lines (143 loc) · 4.02 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
`maven-publish`
`java-library`
signing
jacoco
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
kotlin("jvm") version "1.7.10"
id("org.jetbrains.dokka") version "1.7.10"
}
group = "com.fortechteams"
version = project
.rootProject
.file("version.txt")
.readText(Charsets.UTF_8)
.trim()
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
api("org.keycloak", "keycloak-admin-client", "18.0.2")
implementation("org.slf4j", "slf4j-api", "1.7.36")
testImplementation("io.mockk", "mockk", "1.9.3")
testImplementation(kotlin("test"))
testImplementation("org.junit.jupiter:junit-jupiter:5.9.0")
testImplementation("ch.qos.logback:logback-classic:1.4.1")
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
withSourcesJar()
withJavadocJar()
}
publishing {
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["kotlin"])
artifact(tasks["sourcesJar"])
artifact(tasks["javadocJar"])
pom {
name.set(project.name)
description.set("KCloak library - A Kotlin DSL for KeyCloak")
url.set("https://oss.4techteams.com/kcloak")
licenses {
license {
name.set("MIT")
url.set("https://opensource.org/licenses/MIT")
}
}
organization {
name.set("4TechTeams.com")
url.set("https://www.4techteams.com")
}
developers {
developer {
id.set("frne")
name.set("Frank Neff")
url.set("https://frankneff.com")
}
}
scm {
url.set(
"https://github.com/4TechTeams/kcloak.git"
)
connection.set(
"scm:git:git://github.com/4TechTeams/kcloak.git"
)
developerConnection.set(
"scm:git:git://github.com/4TechTeams/kcloak.git"
)
}
issueManagement {
url.set("https://github.com/4TechTeams/kcloak/issues")
}
}
}
}
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
val ossrhUsername = providers
.environmentVariable("OSSRH_USERNAME")
.forUseAtConfigurationTime()
val ossrhPassword = providers
.environmentVariable("OSSRH_PASSWORD")
.forUseAtConfigurationTime()
if (ossrhUsername.isPresent && ossrhPassword.isPresent) {
username.set(ossrhUsername.get())
password.set(ossrhPassword.get())
}
}
}
}
signing {
val signingKey = providers
.environmentVariable("GPG_SIGNING_KEY")
.forUseAtConfigurationTime()
val signingPassphrase = providers
.environmentVariable("GPG_SIGNING_PASSPHRASE")
.forUseAtConfigurationTime()
if (signingKey.isPresent && signingPassphrase.isPresent) {
useInMemoryPgpKeys(signingKey.get(), signingPassphrase.get())
val extension = extensions
.getByName("publishing") as PublishingExtension
sign(extension.publications)
}
}
jacoco {
toolVersion = "0.8.7"
}
tasks.jacocoTestReport {
dependsOn(tasks.test) // tests are required to run before generating the report
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "11"
}
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
exceptionFormat = TestExceptionFormat.FULL
events = setOf(
TestLogEvent.STARTED,
TestLogEvent.SKIPPED,
TestLogEvent.PASSED,
TestLogEvent.FAILED,
TestLogEvent.STANDARD_OUT,
TestLogEvent.STANDARD_ERROR
)
}
finalizedBy(tasks.jacocoTestReport)
}