Skip to content

Commit

Permalink
upgrade: override the JVM Target of subprojects so that we don't have…
Browse files Browse the repository at this point in the history
… to suppress compile errors
  • Loading branch information
w568w committed Jan 12, 2025
1 parent d94fbd2 commit 2b8e3ad
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
33 changes: 21 additions & 12 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,33 @@ subprojects {
if (project.plugins.hasPlugin("com.android.application") ||
project.plugins.hasPlugin("com.android.library")) {
project.android.compileSdkVersion = 35

// override Java version to 23
project.android.compileOptions.sourceCompatibility = JavaVersion.VERSION_23
project.android.compileOptions.targetCompatibility = JavaVersion.VERSION_23

// override Kotlin JVM target to 23 too
project.tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = "23"
}
}

if (project.android.namespace == null) {
def manifest = new XmlSlurper().parse(file(project.android.sourceSets.main.manifest.srcFile))
def packageName = manifest.@package.text()
println("Setting ${packageName} as android namespace")
project.android.namespace = packageName
}
// override the kotlin language version for each dependencies to 2.0.20
if (project.buildscript.configurations.hasProperty("classpath")) {
def found = false
project.buildscript.configurations.classpath.getDependencies().each { dep ->
if (dep.group == "org.jetbrains.kotlin" && dep.name == "kotlin-gradle-plugin") {
found = true
}
}
if (found) {
project.buildscript.dependencies.add("classpath", "org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.21")
}
}
}
}
}

// override the kotlin language version for each dependencies to 2.1.0
configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'org.jetbrains.kotlin' && details.requested.name == 'kotlin-gradle-plugin') {
details.useVersion '2.1.0'
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ android.enableJetifier=true
org.gradle.jvmargs=-Xmx4096M -XX:MaxNewSize=3G
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configureondemand=false
kotlin.jvm.target.validation.mode=warning
org.gradle.configureondemand=false

0 comments on commit 2b8e3ad

Please sign in to comment.