-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
115 lines (104 loc) · 3.27 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
plugins {
alias(libs.plugins.kotlin)
alias(libs.plugins.dokka)
`maven-publish`
signing
}
repositories {
mavenCentral()
}
kotlin {
explicitApi()
jvmToolchain(17)
applyDefaultHierarchyTemplate()
jvm()
iosX64()
iosArm64()
macosX64()
macosArm64()
linuxX64()
linuxArm64()
mingwX64()
sourceSets {
val jvmTest by getting {
dependencies {
implementation(libs.test.junit)
implementation(libs.test.strikt)
}
}
}
}
val dokkaJar = tasks.register<Jar>("dokkaJar") {
dependsOn(tasks.dokkaGenerate)
from(tasks.dokkaGeneratePublicationHtml.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
}
publishing {
publications {
withType<MavenPublication> {
artifact(dokkaJar)
groupId = "com.ioki.result"
artifactId = artifactId.lowercase()
version = "0.4.0-SNAPSHOT"
pom {
name.set("Result")
description.set("Result library")
url.set("https://github.com/ioki-mobility/Result")
licenses {
license {
name.set("MIT")
url.set("https://opensource.org/licenses/MIT")
}
}
organization {
name.set("ioki")
url.set("https://ioki.com")
}
developers {
developer {
id.set("ioki")
name.set("ioki Android Team")
organization.set("ioki")
organizationUrl.set("https://www.ioki.com")
}
}
scm {
url.set("https://github.com/ioki-mobility/Result")
connection.set("scm:git:git://github.com/ioki-mobility/Result.git")
developerConnection.set("scm:git:ssh://[email protected]:ioki-mobility/Result.git")
}
}
}
}
repositories {
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") {
name = "SonatypeSnapshot"
credentials {
username = System.getenv("SONATYPE_USER")
password = System.getenv("SONATYPE_PASSWORD")
}
}
maven("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
name = "SonatypeStaging"
credentials {
username = System.getenv("SONATYPE_USER")
password = System.getenv("SONATYPE_PASSWORD")
}
}
}
}
signing {
val signingKey = System.getenv("GPG_SIGNING_KEY")
val signingPassword = System.getenv("GPG_SIGNING_PASSWORD")
isRequired = hasProperty("GPG_SIGNING_REQUIRED")
if (isRequired) useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications)
}
// Workaround taken from here:
// https://github.com/gradle/gradle/issues/26091#issuecomment-1722947958
// Maybe fix can be found here:
// https://github.com/gradle/gradle/pull/26292
tasks.withType<AbstractPublishToMaven>().configureEach {
val signingTasks = tasks.withType<Sign>()
mustRunAfter(signingTasks)
}