forked from mscheong01/krotoDC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
127 lines (111 loc) · 3.81 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
import java.io.FileInputStream
import java.io.FileOutputStream
import java.util.Properties
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"
id("com.google.cloud.artifactregistry.gradle-plugin") version "2.2.0"
}
group = "ai.qanda"
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()
}
allprojects {
apply(plugin = "com.google.cloud.artifactregistry.gradle-plugin")
}
subprojects {
apply {
plugin("java")
plugin("org.jetbrains.kotlin.jvm")
plugin("com.google.protobuf")
plugin("maven-publish")
plugin("org.jlleitschuh.gradle.ktlint")
}
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 {
version = version
name = "qanda-packages"
url = uri("artifactregistry://asia-northeast3-maven.pkg.dev/mp-artifact-registry-aa49/qanda-packages")
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
}
configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
ktlint {
filter {
exclude { entry ->
entry.file.toString().contains("generated")
}
}
}
}
}
task("updateVersion") {
properties["releaseVersion"]?.let { releaseVersion ->
val newSnapshotVersion = (releaseVersion as String).split(".").let {
"${it[0]}.${it[1].toInt() + 1}.0-SNAPSHOT"
}
val file = File(rootDir, "gradle.properties")
val prop = Properties().apply { load(FileInputStream(file)) }
if (prop.getProperty("version") != newSnapshotVersion) {
prop.setProperty("version", newSnapshotVersion)
prop.store(FileOutputStream(file), null)
}
}
}