-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.gradle.kts
139 lines (123 loc) · 4.13 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
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
kotlin("jvm") version "2.1.10"
id("io.gitlab.arturbosch.detekt") version "1.23.8"
id("com.adarshr.test-logger") version "4.0.0"
jacoco
`java-library`
`maven-publish`
signing
}
group = "io.github.chriskn"
version = "0.13.0"
java.sourceCompatibility = JavaVersion.VERSION_17
repositories {
mavenCentral()
}
val structurizrVersion = "3.2.1"
val structurizrExportVersion = "3.2.1"
val junitVersion = "5.11.4"
val assertJVersion = "3.27.3"
val detektVersion = "1.23.8"
val kotlinLoggingVersion = "3.0.5"
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("io.github.microutils:kotlin-logging:$kotlinLoggingVersion")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.3")
api("com.structurizr:structurizr-core:$structurizrVersion")
api("com.structurizr:structurizr-export:$structurizrExportVersion")
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion")
testImplementation(platform("org.junit:junit-bom:$junitVersion"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.assertj:assertj-core:$assertJVersion")
}
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}
tasks {
test {
useJUnitPlatform()
}
javadoc {
if (JavaVersion.current().isJava9Compatible) {
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
}
}
}
detekt {
buildUponDefaultConfig = true
config.setFrom(files("$projectDir/config/detekt.yml"))
parallel = true
autoCorrect = true
}
// Force detekt to use a compatible Kotlin version.
// See https://github.com/detekt/detekt/issues/7304
configurations.matching { it.name == "detekt" }.all {
resolutionStrategy.eachDependency {
if (requested.group == "org.jetbrains.kotlin") {
useVersion(io.gitlab.arturbosch.detekt.getSupportedKotlinVersion())
}
}
}
java {
withJavadocJar()
withSourcesJar()
}
publishing {
val uri = "github.com/chriskn/structurizr-c4puml-extension"
publications {
create<MavenPublication>("mavenJava") {
artifactId = "structurizr-c4puml-extension"
from(components["java"])
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
pom {
name.set("Structurizr C4Puml Extension")
description.set(
"Kotlin based extension to the Structurizr java library in order to use extended C4Puml features"
)
url.set("https//:$uri")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("chriskn")
name.set("Christoph Knauf")
email.set("[email protected]")
}
}
scm {
connection.set("scm:https//:$uri.git")
developerConnection.set("scm:git://$uri.git")
url.set("https//:$uri")
}
}
}
}
repositories {
maven {
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
credentials {
username = project.properties["ossrhUsername"].toString()
password = project.properties["ossrhPassword"].toString()
}
}
}
}
signing {
sign(publishing.publications["mavenJava"])
}