-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
111 lines (88 loc) · 2.77 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.9.20"
`maven-publish`
signing
id("org.jetbrains.dokka") version "1.9.10"
id("io.gitlab.arturbosch.detekt").version("1.23.4")
}
group = "br.com.colman.simplecnpjvalidator"
version = System.getenv("RELEASE_VERSION") ?: "local"
repositories {
mavenCentral()
}
dependencies {
testImplementation("io.kotest:kotest-runner-junit5:5.8.0")
testImplementation("io.kotest:kotest-property:5.8.0")
}
kotlin {
jvmToolchain(8)
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
tasks.withType<Test> {
useJUnitPlatform()
}
val sourcesJar by tasks.registering(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.getByName("main").allSource)
}
val javadocJar by tasks.registering(Jar::class) {
dependsOn("dokkaHtml")
archiveClassifier.set("javadoc")
from("${layout.buildDirectory}/dokka")
}
publishing {
repositories {
maven("https://oss.sonatype.org/service/local/staging/deploy/maven2") {
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_PASSWORD")
}
}
}
publications {
register("mavenJava", MavenPublication::class) {
from(components["java"])
artifact(sourcesJar.get())
artifact(javadocJar.get())
pom {
name.set("SimpleCnpjValidator")
description.set("Simple CNPJ Validator")
url.set("https://www.github.com/LeoColman/SimpleCnpjValidator")
scm {
connection.set("scm:git:http://www.github.com/LeoColman/SimpleCnpjValidator/")
developerConnection.set("scm:git:http://github.com/LeoColman/")
url.set("https://www.github.com/LeoColman/SimpleCnpjValidator")
}
licenses {
license {
name.set("The Apache 2.0 License")
url.set("https://opensource.org/licenses/Apache-2.0")
}
}
developers {
developer {
id.set("LeoColman")
name.set("Leonardo Colman Lopes")
email.set("dev@leonardo.colman.com.br")
}
}
}
}
}
}
val signingKey: String? by project
val signingPassword: String? by project
signing {
useGpgCmd()
if(signingKey != null && signingPassword != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign(publishing.publications["mavenJava"])
}
detekt {
autoCorrect = true
buildUponDefaultConfig = true
}