Skip to content

Commit

Permalink
Change Java version definition
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 committed May 21, 2024
1 parent 61b7bbf commit d3d6e09
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@
*/
package ch.srgssr.pillarbox.gradle.internal

import org.gradle.api.JavaVersion
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

internal object AppConfig {
// When changing this value, don't forget to also update the Detekt config in the root `build.gradle.kts` file
private val javaVersionName = "17"

internal const val minSdk = 21
internal const val targetSdk = 34
internal const val compileSdk = 34

// When changing this value, don't forget to also update the Detekt config in the root `build.gradle.kts` file
internal val javaVersion = "17"
internal val javaVersion = JavaVersion.valueOf("VERSION_$javaVersionName")
internal val jvmTarget = JvmTarget.fromTarget(javaVersionName)
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ internal fun Project.configureAndroidModule(extension: CommonExtension<*, *, *,
}

compileOptions {
sourceCompatibility = JavaVersion.valueOf("VERSION_" + AppConfig.javaVersion)
targetCompatibility = JavaVersion.valueOf("VERSION_" + AppConfig.javaVersion)
sourceCompatibility = AppConfig.javaVersion
targetCompatibility = AppConfig.javaVersion
isCoreLibraryDesugaringEnabled = true
}

Expand All @@ -40,7 +40,7 @@ internal fun Project.configureAndroidModule(extension: CommonExtension<*, *, *,
internal fun Project.configureKotlinModule() {
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.fromTarget(AppConfig.javaVersion))
jvmTarget.set(AppConfig.jvmTarget)
}
}
}
Expand Down

0 comments on commit d3d6e09

Please sign in to comment.