-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.gradle.kts
136 lines (122 loc) · 4.16 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
plugins {
kotlin("jvm") version "2.0.20" apply false
id("com.google.protobuf") version "0.9.4" 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.66.0"
ext["grpcKotlinVersion"] = "1.4.1"
ext["protobufVersion"] = "3.25.4"
ext["coroutinesVersion"] = "1.8.1"
ext["kotlinPoetVersion"] = "1.18.1"
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("icycle0409@snu.ac.kr")
organization.set("MinsooCheong")
organizationUrl.set("https://github.com/mscheong01")
}
}
scm {
connection.set("scm:git:git@github.com:mscheong01/krotoDC.git")
developerConnection.set("scm:git:git@github.com: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")
}
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
}
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)
}
}
}