Skip to content

Commit

Permalink
Update JVM target related things
Browse files Browse the repository at this point in the history
  • Loading branch information
isaac-udy committed Nov 13, 2024
1 parent 30bb6cb commit 1b80ce2
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 11 deletions.
1 change: 1 addition & 0 deletions .run/Enro [disableConnectedDeviceAnimations].run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
1 change: 1 addition & 0 deletions .run/Enro [enableConnectedDeviceAnimations].run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
7 changes: 7 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

repositories {
mavenLocal()
google()
Expand All @@ -12,6 +14,11 @@ java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>() {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}

dependencies {
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
Expand Down
11 changes: 6 additions & 5 deletions buildSrc/src/main/kotlin/configureAndroid.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.the
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.FileInputStream
import java.util.Properties
Expand Down Expand Up @@ -72,17 +73,17 @@ private fun Project.commonAndroidConfig(
}

tasks.withType<KotlinCompile>() {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)

// We want to disable the automatic inclusion of the `dev.enro.annotations.AdvancedEnroApi` and `dev.enro.annotations.ExperimentalEnroApi`
// opt-ins when we're compiling the test application, so that we're not accidentally making changes that might break the public API by
// requiring the opt-ins.
if (path.startsWith(":tests:application")) {
return@kotlinOptions
return@compilerOptions
}
freeCompilerArgs += "-Xopt-in=dev.enro.annotations.AdvancedEnroApi"
freeCompilerArgs += "-Xopt-in=dev.enro.annotations.ExperimentalEnroApi"
freeCompilerArgs.add("-Xopt-in=dev.enro.annotations.AdvancedEnroApi")
freeCompilerArgs.add("-Xopt-in=dev.enro.annotations.ExperimentalEnroApi")
}
}

Expand Down
6 changes: 4 additions & 2 deletions buildSrc/src/main/kotlin/configureExplicitApi.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

fun Project.configureExplicitApi() {
tasks.withType<KotlinCompile>() {
kotlinOptions {
freeCompilerArgs += "-Xexplicit-api=strict"
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
freeCompilerArgs.add("-Xexplicit-api=strict")
}
}
}
7 changes: 5 additions & 2 deletions enro-test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id("com.android.library")
id("kotlin-android")
Expand All @@ -6,8 +8,9 @@ configureAndroidLibrary("dev.enro.test")
configureAndroidPublishing("dev.enro:enro-test")

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>() {
kotlinOptions {
freeCompilerArgs += "-Xfriend-paths=../enro-core/src/main"
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
freeCompilerArgs.add("-Xfriend-paths=../enro-core/src/main")
}
}

Expand Down
7 changes: 5 additions & 2 deletions enro/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id("com.google.devtools.ksp")
id("com.android.library")
Expand All @@ -24,8 +26,9 @@ android {
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>() {
kotlinOptions {
freeCompilerArgs += "-Xfriend-paths=../enro-core/src/main"
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
freeCompilerArgs.add("-Xfriend-paths=../enro-core/src/main")
}
}

Expand Down

0 comments on commit 1b80ce2

Please sign in to comment.