-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
78 lines (67 loc) · 2.57 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
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
plugins {
id("com.android.application") version "7.1.1" apply false
id("com.android.library") version "7.1.1" apply false
id("org.jetbrains.kotlin.android") version "1.6.10" apply false
id("io.github.gradle-nexus.publish-plugin") version "1.1.0" apply false
}
allprojects {
group = "io.github.ppav"
version = "0.0.4"
val localProps = gradleLocalProperties(rootDir)
val emptyJavadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}
afterEvaluate {
extensions.findByType<PublishingExtension>()
?.apply {
publications.withType<MavenPublication>()
.configureEach {
artifact(emptyJavadocJar.get())
pom {
name.set("SomeAdapter")
description.set("Android framework")
url.set("https://github.com/ppav/SomeAdapter")
licenses {
license {
name.set("MIT")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set(localProps.getProperty("developerId"))
name.set(localProps.getProperty("developerName"))
email.set(localProps.getProperty("developerEmail"))
}
}
scm {
url.set("https://github.com/ppav/SomeAdapter")
}
}
}
repositories {
maven {
name = "sonatype"
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = localProps.getProperty("ossrhUsername")
password = localProps.getProperty("ossrhPassword")
}
}
}
}
project.ext["signing.keyId"] = localProps.getProperty("signing.keyId")
project.ext["signing.secretKeyRingFile"] = localProps.getProperty("signing.secretKeyRingFile")
project.ext["signing.password"] = localProps.getProperty("signing.password")
extensions.findByType<SigningExtension>()
?.apply {
val publishing = extensions.findByType<PublishingExtension>() ?: return@apply
sign(publishing.publications)
}
val isReleaseBuild = localProps.containsKey("signing.keyId")
tasks.withType<Sign>().configureEach {
onlyIf { isReleaseBuild }
}
}
}