Merge pull request #689 from android/source_target_compat_to_11

Set the source/target compatibility to 11
pull/692/head
Don Turner 2 years ago committed by GitHub
commit c8b776658a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -23,13 +23,15 @@ plugins {
group = "com.google.samples.apps.nowinandroid.buildlogic" group = "com.google.samples.apps.nowinandroid.buildlogic"
java { java {
sourceCompatibility = JavaVersion.VERSION_17 // Up to Java 11 APIs are available through desugaring
targetCompatibility = JavaVersion.VERSION_17 // https://developer.android.com/studio/write/java11-minimal-support-table
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
} }
tasks.withType<KotlinCompile>().configureEach { tasks.withType<KotlinCompile>().configureEach {
kotlinOptions { kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString() jvmTarget = JavaVersion.VERSION_11.toString()
} }
} }

@ -17,12 +17,10 @@
package com.google.samples.apps.nowinandroid package com.google.samples.apps.nowinandroid
import com.android.build.api.dsl.CommonExtension import com.android.build.api.dsl.CommonExtension
import org.gradle.api.JavaVersion
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalogsExtension import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.kotlin.dsl.dependencies import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.getByType import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.withType import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.File import java.io.File

@ -40,8 +40,10 @@ internal fun Project.configureKotlinAndroid(
} }
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_17 // Up to Java 11 APIs are available through desugaring
targetCompatibility = JavaVersion.VERSION_17 // https://developer.android.com/studio/write/java11-minimal-support-table
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
isCoreLibraryDesugaringEnabled = true isCoreLibraryDesugaringEnabled = true
} }
} }
@ -50,7 +52,7 @@ internal fun Project.configureKotlinAndroid(
tasks.withType<KotlinCompile>().configureEach { tasks.withType<KotlinCompile>().configureEach {
kotlinOptions { kotlinOptions {
// Set JVM target to 17 // Set JVM target to 17
jvmTarget = JavaVersion.VERSION_17.toString() jvmTarget = JavaVersion.VERSION_11.toString()
// Treat all Kotlin warnings as errors (disabled by default) // Treat all Kotlin warnings as errors (disabled by default)
// Override by setting warningsAsErrors=true in your ~/.gradle/gradle.properties // Override by setting warningsAsErrors=true in your ~/.gradle/gradle.properties
val warningsAsErrors: String? by project val warningsAsErrors: String? by project

@ -23,13 +23,15 @@ plugins {
} }
java { java {
sourceCompatibility = JavaVersion.VERSION_17 // Up to Java 11 APIs are available through desugaring
targetCompatibility = JavaVersion.VERSION_17 // https://developer.android.com/studio/write/java11-minimal-support-table
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
} }
tasks.withType<KotlinCompile>().configureEach { tasks.withType<KotlinCompile>().configureEach {
kotlinOptions { kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString() jvmTarget = JavaVersion.VERSION_11.toString()
} }
} }

Loading…
Cancel
Save