/
build.gradle.kts
122 lines (103 loc) · 3.99 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
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.3.50"
id("maven")
id("signing")
id("org.jetbrains.dokka") version "0.10.0"
}
group = "app.ubie"
version = "1.1.4"
repositories {
jcenter()
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("com.google.cloud:google-cloud-spanner:1.44.0")
testImplementation("io.mockk:mockk:1.9.3")
testImplementation("org.assertj:assertj-core:3.13.2")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.5.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.5.2")
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
val dokka by tasks.getting(DokkaTask::class) {
outputFormat = "html"
outputDirectory = "$buildDir/javadoc"
}
val dokkaJar by tasks.creating(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
archiveClassifier.set("javadoc")
from(dokka)
}
val sourcesJar by tasks.creating(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}
artifacts.add("archives", dokkaJar)
artifacts.add("archives", sourcesJar)
signing {
isRequired = System.getenv("CI")?.toBoolean()?.not() ?: true
sign(configurations.archives.get())
}
val uploadArchives: Upload by tasks
uploadArchives.apply {
repositories {
withConvention(MavenRepositoryHandlerConvention::class) {
mavenDeployer {
beforeDeployment {
signing.signPom(this)
}
val username = getProperty("sonatypeUsername")
val password = getProperty("sonatypePassword")
withGroovyBuilder {
"snapshotRepository"("url" to "https://oss.sonatype.org/content/repositories/snapshots") {
"authentication"("userName" to username, "password" to password)
}
"repository"("url" to "https://oss.sonatype.org/service/local/staging/deploy/maven2") {
"authentication"("userName" to username, "password" to password)
}
}
pom.project {
withGroovyBuilder {
"name"("spanner-kase")
"artifactId"("spanner-kase")
"packaging"("jar")
"url"("https://github.com/ubie-inc/spanner-kase")
"description"("spanner-kase is the library that schema version management tool")
"scm" {
"connection"("scm:git:git://github.com/ubie-inc/spanner-kase.git")
"developerConnection"("scm:git:ssh://git@github.com:ubie-inc/spanner-kase.git")
"url"("https://github.com/ubie-inc/spanner-kase")
}
"licenses" {
"license" {
"name"("The Apache Software License, Version 2.0")
"url"("http://www.apache.org/licenses/LICENSE-2.0.txt")
"distribution"("repo")
}
}
"developers" {
"developer" {
"id"("sys1yagi")
"name"("Toshihiro Yagi")
}
}
"issueManagement" {
"system"("github")
"url"("https://github.com/ubie-inc/spanner-kase/issues")
}
}
}
}
}
}
}
fun getProperty(propertyName: String): String? {
if(project.hasProperty(propertyName))
return project.properties[propertyName] as? String
return System.getenv(propertyName)
}