-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
184 lines (165 loc) · 5.19 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
import java.util.*
plugins {
kotlin("jvm") version "1.4.21"
java
maven
`maven-publish`
id("com.jfrog.bintray") version "1.8.1"
}
val artifactId = "gistcafe"
val repoName = "ServiceStack/gistcafe-kotlin"
val repoUrl = "https://github.com/$repoName"
val orgName = "ServiceStack"
val shortDesc = "gist.cafe utils for Kotlin"
val artifactVersion = version.toString()
val bintrayUpload: com.jfrog.bintray.gradle.tasks.BintrayUploadTask by tasks
val clean: Task by tasks
val build: Task by tasks
repositories {
jcenter()
}
tasks {
create<Jar>("sourceJar") {
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}
create<Jar>("javadocJar") {
dependsOn.add(javadoc)
archiveClassifier.set("javadoc")
from(javadoc)
}
withType<Jar> {
archiveBaseName.set(artifactId)
}
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
artifact(tasks["sourceJar"])
artifactId = artifactId
version = artifactVersion
pom {
name.set(artifactId)
description.set(shortDesc)
url.set("https://github.com/$repoName")
licenses {
license {
name.set("The 3-Clause BSD License")
url.set("https://opensource.org/licenses/BSD-3-Clause")
distribution.set("repo")
}
}
developers {
developer {
id.set(orgName)
name.set("$orgName, Inc.")
email.set("team@servicestack.net")
}
}
scm {
connection.set("scm:git:git://github.com/$repoName.git")
developerConnection.set("scm:git:ssh://github.com/$repoName.git")
url.set(repoUrl)
}
}
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/servicestack/gistcafe-kotlin")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
bintrayUpload.apply {
dependsOn(clean)
dependsOn(build)
build.mustRunAfter(clean)
onlyIf { System.getenv("BINTRAY_USER").isNotEmpty() }
onlyIf { System.getenv("BINTRAY_APIKEY").isNotEmpty() }
doFirst {
println("Generating Maven POM file to $buildDir/poms/pom-default.xml")
maven.pom {
project {
withGroovyBuilder {
"name"(artifactId)
"description"(shortDesc)
"url"("https://github.com/$repoName")
"licenses" {
"license" {
"name"("The 3-Clause BSD License")
"url"("https://opensource.org/licenses/BSD-3-Clause")
"distribution"("repo")
}
}
"developers" {
"developer" {
"id"(orgName)
"name"("$orgName, Inc.")
"email"("team@servicestack.net")
}
}
"scm" {
"connection"("scm:git:git://github.com/$repoName.git")
"developerConnection"("scm:git:ssh://github.com/$repoName.git")
"url"(repoUrl)
}
}
}
}
.writeTo("$buildDir/poms/pom-default.xml")
}
}
bintray {
user = System.getenv("BINTRAY_USER")
key = System.getenv("BINTRAY_APIKEY")
publish = true
setConfigurations("archives")
pkg.apply {
repo = "maven"
name = artifactId
userOrg = orgName.toLowerCase()
websiteUrl = "https://gist.cafe"
issueTrackerUrl = "https://github.com/$repoName/issues"
githubRepo = repoName
vcsUrl = "https://github.com/$repoName"
description = shortDesc
setLabels("servicestack","gistcafe","kotlin")
setLicenses("BSD 3-Clause")
desc = shortDesc
version.apply {
name = artifactVersion
desc = repoUrl
released = Date().toString()
vcsTag = artifactVersion
gpg.apply {
sign = true
}
mavenCentralSync.apply {
sync = true
user = System.getenv("OSSRH_USER")
password = System.getenv("OSSRH_PASS")
close = "1"
}
}
}
}
artifacts {
add("archives", tasks["jar"])
add("archives", tasks["sourceJar"])
add("archives", tasks["javadocJar"])
}
tasks.test {
useJUnitPlatform()
}
dependencies {
implementation(kotlin("stdlib"))
implementation("com.google.code.gson:gson:2.8.6")
testImplementation(platform("org.junit:junit-bom:5.7.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
}