gradle: Enable java 11 language features

Also unify the style while at it

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta 2022-08-19 21:12:42 +05:30
parent f0a3acf4fc
commit 4b8427821b
4 changed files with 12 additions and 15 deletions

View file

@ -38,11 +38,11 @@ android {
abortOnError true abortOnError true
} }
compileOptions { compileOptions {
targetCompatibility 1.8 sourceCompatibility = JavaVersion.VERSION_11
sourceCompatibility 1.8 targetCompatibility = JavaVersion.VERSION_11
} }
kotlinOptions { kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString() jvmTarget = JavaVersion.VERSION_11.toString()
languageVersion = "1.6" languageVersion = "1.6"
} }
testOptions { testOptions {
@ -159,9 +159,6 @@ apply from: "${rootProject.rootDir}/gradle/ktlint.gradle"
gradle.projectsEvaluated { gradle.projectsEvaluated {
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
if (JavaVersion.current() >= JavaVersion.VERSION_1_9) {
options.compilerArgs.addAll(['--release', '8'])
}
options.compilerArgs.add('-Xbootclasspath/p:app/libs/android.jar:app/libs/libcore.jar') options.compilerArgs.add('-Xbootclasspath/p:app/libs/android.jar:app/libs/libcore.jar')
} }
} }

View file

@ -15,12 +15,12 @@ android {
} }
compileOptions { compileOptions {
sourceCompatibility = 1.8 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = 1.8 targetCompatibility = JavaVersion.VERSION_11
} }
kotlinOptions { kotlinOptions {
jvmTarget = '1.8' jvmTarget = JavaVersion.VERSION_11.toString()
} }
testOptions { testOptions {

View file

@ -27,11 +27,11 @@ android {
} }
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_11
} }
kotlinOptions { kotlinOptions {
jvmTarget = '1.8' jvmTarget = JavaVersion.VERSION_11.toString()
freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
} }
lintOptions { lintOptions {

View file

@ -28,11 +28,11 @@ android {
} }
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_11
} }
kotlinOptions { kotlinOptions {
jvmTarget = '1.8' jvmTarget = JavaVersion.VERSION_11.toString()
languageVersion = "1.6" languageVersion = "1.6"
freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn' freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn'
freeCompilerArgs += '-Xexplicit-api=strict' freeCompilerArgs += '-Xexplicit-api=strict'