forked from mscheong01/krotoDC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
132 lines (119 loc) · 4.09 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
plugins {
kotlin("jvm") version "1.7.20" apply false
id("com.google.protobuf") version "0.9.2" apply false
`maven-publish`
id("org.jlleitschuh.gradle.ktlint") version "11.3.1"
signing
}
group = "io.github.mscheong01"
if (project.hasProperty("releaseVersion")) {
version = project.property("releaseVersion") as String
}
ext["grpcJavaVersion"] = "1.54.0"
ext["grpcKotlinVersion"] = "1.3.0"
ext["protobufVersion"] = "3.22.2"
ext["coroutinesVersion"] = "1.6.2"
ext["kotlinPoetVersion"] = "1.12.0"
repositories {
mavenCentral()
}
subprojects {
apply {
plugin("java")
plugin("org.jetbrains.kotlin.jvm")
plugin("com.google.protobuf")
plugin("maven-publish")
plugin("org.jlleitschuh.gradle.ktlint")
plugin("signing")
}
group = rootProject.group
version = rootProject.version
repositories {
mavenCentral()
}
tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}
publishing {
publications {
create<MavenPublication>("maven") {
pom {
url.set("https://github.com/mscheong01/krotoDC")
licenses {
license {
name.set("Apache 2.0")
url.set("https://opensource.org/licenses/Apache-2.0")
distribution.set("repo")
}
}
developers {
developer {
id.set("mscheong01")
name.set("Minsoo Cheong")
email.set("[email protected]")
organization.set("MinsooCheong")
organizationUrl.set("https://github.com/mscheong01")
}
}
scm {
connection.set("scm:git:[email protected]:mscheong01/krotoDC.git")
developerConnection.set("scm:git:[email protected]:mscheong01/krotoDC.git")
url.set("https://github.com/mscheong01/krotoDC")
}
}
}
}
repositories {
maven {
name = "OSSRH"
url = if ((version as String).endsWith("-SNAPSHOT")) {
uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
} else {
uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
}
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}
configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
ktlint {
filter {
exclude { entry ->
entry.file.toString().contains("generated")
}
}
}
}
signing {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications["maven"])
}
tasks.withType<Sign>().configureEach {
onlyIf {
project.hasProperty("releaseVersion")
}
}
}
tasks.create("updateVersion") {
if (rootProject.hasProperty("next")) {
val file = File(rootProject.rootDir, "gradle.properties")
val prop = java.util.Properties().apply { load(java.io.FileInputStream(file)) }
val ver = rootProject.property("next") as String
if (ver != prop.getProperty("version")) {
prop.setProperty("version", ver)
prop.store(java.io.FileOutputStream(file), null)
}
}
}