Skip to content

Instantly share code, notes, and snippets.

@malvinstn
Created December 2, 2019 04:37
Show Gist options
  • Save malvinstn/40bd5cb03293c58470e64814d4044d37 to your computer and use it in GitHub Desktop.
Save malvinstn/40bd5cb03293c58470e64814d4044d37 to your computer and use it in GitHub Desktop.
Apply
import org.gradle.api.JavaVersion
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
class MyModulePlugin : Plugin<Project> {
override fun apply(project: Project) {
...
// Configure common android build parameters.
val androidExtension = project.extensions.getByName("android")
if (androidExtension is BaseExtension) {
androidExtension.apply {
...
// Java 8
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
project.tasks.withType(KotlinCompile::class.java).configureEach {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment