Created
December 2, 2019 04:37
-
-
Save malvinstn/40bd5cb03293c58470e64814d4044d37 to your computer and use it in GitHub Desktop.
Apply
This file contains 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
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