-
-
Notifications
You must be signed in to change notification settings - Fork 757
/
packaging.gradle.kts
75 lines (71 loc) · 2.48 KB
/
packaging.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
plugins {
`java-library`
`maven-publish`
signing
}
tasks.withType<Sign>().configureEach {
notCompatibleWithConfigurationCache("https://github.com/gradle/gradle/issues/13470")
}
publishing {
repositories {
maven {
name = "mavenCentral"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
credentials {
username = "SONATYPE_USERNAME".byProperty
password = "SONATYPE_PASSWORD".byProperty
}
}
maven {
name = "sonatypeSnapshot"
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
credentials {
username = "SONATYPE_USERNAME".byProperty
password = "SONATYPE_PASSWORD".byProperty
}
}
}
// We don't need to configure publishing for the Gradle plugin.
if (project.name != "detekt-gradle-plugin") {
publications.register<MavenPublication>(DETEKT_PUBLICATION) {
groupId = "io.gitlab.arturbosch.detekt"
artifactId = project.name
from(components["java"])
version = Versions.currentOrSnapshot()
pom {
description.set("Static code analysis for Kotlin")
name.set("detekt")
url.set("https://detekt.dev")
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}
developers {
developer {
id.set("Detekt Developers")
name.set("Detekt Developers")
email.set("info@detekt.dev")
}
}
scm {
url.set("https://github.com/detekt/detekt")
}
}
}
}
}
val signingKey = "SIGNING_KEY".byProperty
val signingPwd = "SIGNING_PWD".byProperty
if (signingKey.isNullOrBlank() || signingPwd.isNullOrBlank()) {
logger.info("Signing disabled as the GPG key was not found")
} else {
logger.info("GPG Key found - Signing enabled")
signing {
useInMemoryPgpKeys(signingKey, signingPwd)
publishing.publications.forEach(::sign)
}
}
val String.byProperty: String? get() = findProperty(this) as? String