Last active
May 25, 2020 19:12
-
-
Save lamvann/68319e15fc393a7117a329e99bdcb428 to your computer and use it in GitHub Desktop.
Extension function on Project object to set up an android library
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
fun Project.setupAsAndroidLibrary() { | |
println("\tAndroid Library") | |
apply(plugin = "com.android.library") | |
apply(plugin = "org.jetbrains.kotlin.android") | |
apply(plugin = "org.jetbrains.kotlin.android.extensions") | |
apply(plugin = "org.jetbrains.kotlin.kapt") | |
configure<com.android.build.gradle.LibraryExtension> { | |
compileOptions { | |
sourceCompatibility = VERSION_1_8 | |
targetCompatibility = VERSION_1_8 | |
} | |
compileSdkVersion(28) | |
buildToolsVersion = "28.0.3" | |
defaultConfig { | |
minSdkVersion(23) | |
targetSdkVersion(28) | |
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | |
versionName = version.toString() | |
} | |
dataBinding { | |
isEnabled = true | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment