Skip to content

Commit

Permalink
Merge pull request #2 from takahirom/takahirom/fix-jdk-versions/2024-…
Browse files Browse the repository at this point in the history
…07-30

Fix JDK versions
  • Loading branch information
takahirom authored Jul 30, 2024
2 parents fd77daa + 1ece2e3 commit 180dea7
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
44 changes: 40 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,43 @@
import com.android.build.gradle.BaseExtension

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("root.publication")
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.jetbrains.kotlin.multiplatform) apply false
id("root.publication")
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.jetbrains.kotlin.multiplatform) apply false
}

allprojects {
val javaVersion = rootProject.libs.versions.javaTarget.get()
val toolchainVersion = rootProject.libs.versions.javaToolchain.get()

val javaTargetVersion = JavaVersion.toVersion(javaVersion)
val jvmTargetVersion = org.jetbrains.kotlin.gradle.dsl.JvmTarget.fromTarget(javaVersion)

plugins.withId("java") {
the<JavaPluginExtension>()
.toolchain {
languageVersion.set(JavaLanguageVersion.of(toolchainVersion))
}
}

plugins.withType<com.android.build.gradle.BasePlugin>().configureEach {
the<BaseExtension>()
.compileOptions {
sourceCompatibility = javaTargetVersion
targetCompatibility = javaTargetVersion
}
}

tasks.withType<JavaCompile>().configureEach {
sourceCompatibility = javaTargetVersion.name
targetCompatibility = javaTargetVersion.name
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
compilerOptions {
jvmTarget.set(jvmTargetVersion)
}
}
}
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ espressoCore = "3.6.1"
appcompat = "1.7.0"
material = "1.12.0"
nexus-publish = "2.0.0"
javaToolchain = "17"
javaTarget = "11"

[libraries]
junit = { group = "junit", name = "junit", version.ref = "junit" }
Expand Down

0 comments on commit 180dea7

Please sign in to comment.