Make AGP, buildTools, kotlin and java versions configurable via system properties

pull/2022/head
Bo Zhang 2 weeks ago
parent 705fd9068b
commit d61b0a3f92
No known key found for this signature in database
GPG Key ID: 3D059DA7C86A8B3C

@ -25,14 +25,15 @@ group = "com.google.samples.apps.nowinandroid.buildlogic"
// Configure the build-logic plugins to target JDK 17
// This matches the JDK used to build the project, and is not related to what is running on device.
val javaVersion = System.getProperty("javaVersion","17")
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.toVersion(javaVersion)
targetCompatibility = JavaVersion.toVersion(javaVersion)
}
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
jvmTarget = JvmTarget.fromTarget(javaVersion)
}
}

@ -36,6 +36,7 @@ internal fun Project.configureKotlinAndroid(
) {
commonExtension.apply {
compileSdk = 35
buildToolsVersion = System.getProperty("buildToolsVersion", "35.0.0")
defaultConfig {
minSdk = 23

@ -35,6 +35,9 @@ dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
// Synchronize changes with root settings.gradle.kts
version("androidGradlePlugin", System.getProperty("agpVersion", "8.13.0"))
version("kotlin", System.getProperty("kotlinVersion", "2.2.20"))
}
}
}

@ -83,3 +83,13 @@ check(JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
https://developer.android.com/build/jdks#jdk-config-in-studio
""".trimIndent()
}
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
// Synchronize changes with build-logic/settings.gradle.kts
version("androidGradlePlugin", System.getProperty("agpVersion", "8.13.0"))
version("kotlin", System.getProperty("kotlinVersion", "2.2.20"))
}
}
}

Loading…
Cancel
Save