-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
executable file
·141 lines (126 loc) · 3.83 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
140
141
import groovy.lang.Closure
import org.gradle.api.publish.maven.MavenPom
buildscript {
repositories {
mavenCentral()
}
}
plugins {
kotlin("multiplatform") version "1.4.10"
id("com.palantir.git-version") version "0.12.3"
id("com.jfrog.bintray") version "1.8.5"
`maven-publish`
}
repositories {
mavenCentral()
}
val artifactId = "kase-format"
group = "io.dotcipher.kase"
// Use explicit cast for groovy call (see https://github.com/palantir/gradle-git-version/issues/105)
version = (extensions.extraProperties.get("gitVersion") as? Closure<*>)?.call() ?: "dirty"
description = "Multiplatform kotlin string case conversion and detection library"
// Kotlin multiplatform configuration
kotlin {
jvm()
sourceSets {
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val jvmTest by getting {
dependencies {
implementation(kotlin("test-junit"))
}
}
}
}
val stubSources = tasks.create("stubSources", Jar::class) {
archiveClassifier.set("sources")
}
val stubJavadoc = tasks.create("stubJavadoc", Jar::class) {
archiveClassifier.set("javadoc")
}
val sourcesJar = tasks.create("sourcesJar", Jar::class) {
archiveClassifier.set("sources")
from(kotlin.sourceSets.commonMain.get().kotlin)
}
tasks.withType<Jar> {
manifest.attributes.apply {
put("Implementation-Title", project.name)
put("Implementation-Version", project.version)
}
}
val mavenPomConfiguration: ((MavenPom).() -> Unit) =
{
url.set("https://github.com/dotCipher/kase-format")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("dotCipher")
name.set("Cody Moore")
email.set("cody at dotcipher.io")
}
}
scm {
connection.set("scm:git:git://github.com/dotcipher/kase-format.git")
developerConnection.set("scm:git:ssh://github.com/dotcipher/kase-format.git")
url.set("https://github.com/dotCipher/kase-format")
}
}
// Publication distribution configuration
publishing {
publications {
getByName<MavenPublication>("jvm") {
pom { mavenPomConfiguration.invoke(this) }
}
create("maven", MavenPublication::class) {
artifactId = project.name
from(components["kotlin"])
artifact(sourcesJar)
pom { mavenPomConfiguration.invoke(this) }
}
}
}
afterEvaluate {
project.publishing.publications.all {
if (this is MavenPublication) {
if (this.name.contains("metadata")) {
this.artifactId = artifactId
}
}
}
}
// Bintray upload configuration
bintray {
user = System.getenv("BINTRAY_USER")
key = System.getenv("BINTRAY_KEY")
with(pkg) {
userOrg = "dotcipher"
repo = "maven"
name = project.name
setLicenses("Apache-2.0")
setPublications("maven", "jvm", "metadata")
vcsUrl = "https://github.com/dotCipher/kase-format"
issueTrackerUrl = "https://github.com/dotCipher/kase-format/issues"
githubRepo = "dotCipher/kase-format"
setLabels("kotlin", "library", "multiplatform")
publicDownloadNumbers = true
with(version) {
name = project.version.toString()
desc = project.description
vcsTag = project.version.toString()
}
}
publish = true
override = true
}
tasks.bintrayUpload.configure {
dependsOn(tasks.publishToMavenLocal)
}