Created
December 10, 2018 12:03
-
-
Save liminal/f0735a3c826ee3c287541d8960f398fd to your computer and use it in GitHub Desktop.
The "I just want everything to be Java 8" root build.gradle additions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Just add these to the root build.gradle of any project where | |
// you just want everything to be Java 8 by default | |
subprojects { | |
project.plugins.whenPluginAdded { plugin -> | |
if ("com.android.build.gradle.AppPlugin" == plugin.class.name | |
|| "com.android.build.gradle.LibraryPlugin" == plugin.class.name) { | |
project.android.compileOptions { | |
sourceCompatibility JavaVersion.VERSION_1_8 | |
targetCompatibility JavaVersion.VERSION_1_8 | |
} | |
} | |
} | |
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { | |
kotlinOptions.jvmTarget = "1.8" | |
} | |
tasks.withType(JavaCompile) { | |
sourceCompatibility = JavaVersion.VERSION_1_8 | |
targetCompatibility = JavaVersion.VERSION_1_8 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment