-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
145 lines (124 loc) · 4.69 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
import com.android.build.api.dsl.ApplicationExtension
import com.android.build.gradle.LibraryExtension
import com.android.build.gradle.TestExtension
import com.vanniktech.maven.publish.SonatypeHost
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinTopLevelExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.compose) apply false
alias(libs.plugins.gradleMavenPublish) apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.androidx.benchmark) apply false
}
apply(rootProject.file("gradle/ktlint.gradle.kts"))
object AndroidConfig {
const val compileSdkVersion = 34
const val targetSdkVersion = 34
const val minSdkVersion = 23
const val composeCompilerVersion = "1.5.14"
}
val javaVersion = JavaVersion.VERSION_1_8
val javaVersionInt = javaVersion.ordinal + 1
val jvmTarget = JvmTarget.JVM_1_8
val ref = System.getenv()["GITHUB_REF"]
val releaseVersion: String? = if (
System.getenv()["GITHUB_REF_TYPE"] == "tag" &&
ref?.startsWith("refs/tags/v") == true
) {
ref.removePrefix("refs/tags/v")
.also { println("Releasing Version: $it") }
} else {
null
}
subprojects {
group = "dev.scottpierce"
version = "0.1.0"
plugins.withId("com.android.application") {
configure<ApplicationExtension> {
compileOptions {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
compileSdk = AndroidConfig.compileSdkVersion
defaultConfig {
minSdk = AndroidConfig.minSdkVersion
targetSdk = AndroidConfig.targetSdkVersion
}
}
}
plugins.withId("com.android.library") {
configure<LibraryExtension> {
compileOptions {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
compileSdk = AndroidConfig.compileSdkVersion
defaultConfig {
minSdk = AndroidConfig.minSdkVersion
}
}
}
plugins.withId("com.android.test") {
configure<TestExtension> {
compileOptions {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
compileSdk = AndroidConfig.compileSdkVersion
defaultConfig {
minSdk = AndroidConfig.minSdkVersion
targetSdk = AndroidConfig.targetSdkVersion
}
}
}
tasks.withType<KotlinCompile> {
compilerOptions.jvmTarget.set(jvmTarget)
}
plugins.withId("org.jetbrains.kotlin.jvm") {
configure<KotlinTopLevelExtension> {
jvmToolchain(javaVersionInt)
}
}
if (releaseVersion != null) {
plugins.withId("com.vanniktech.maven.publish") {
configure<com.vanniktech.maven.publish.MavenPublishBaseExtension> {
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
signAllPublications()
coordinates(
groupId = "dev.scottpierce",
artifactId = project.name,
version = releaseVersion,
)
pom {
name.set("Kinject")
description.set("A simple Kotlin Multiplatform dependency injection library.")
inceptionYear.set("2024")
url.set("https://github.com/ScottPierce/kinject")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("ScottPierce")
name.set("Scott Pierce")
url.set("https://github.com/ScottPierce")
}
}
scm {
url.set("https://github.com/ScottPierce/kinject")
connection.set("scm:git:git://github.com/ScottPierce/kinject.git")
developerConnection.set("scm:git:ssh://[email protected]/ScottPierce/kinject.git")
}
}
}
}
}
}