Last active
July 31, 2020 11:19
-
-
Save LightYearsBehind/6ae6cc5c37832d2391f7b6817428c21f to your computer and use it in GitHub Desktop.
Migrating Groovy to Kotlin DSL (ref: https://medium.com/@tantzewee/migrating-from-groovy-to-kotlin-dsl-in-android-f5bba32c622f)
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
apply plugin: 'com.android.application' | |
apply plugin: 'kotlin-android' | |
apply plugin: 'kotlin-android-extensions' | |
android { | |
compileSdkVersion 29 | |
buildToolsVersion "29.0.3" | |
defaultConfig { | |
applicationId "com.geniewits.groovy2kotlin" | |
minSdkVersion 21 | |
targetSdkVersion 29 | |
versionCode 1 | |
versionName "1.0" | |
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | |
} | |
buildTypes { | |
release { | |
minifyEnabled false | |
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | |
} | |
} | |
compileOptions { | |
sourceCompatibility JavaVersion.VERSION_1_8 | |
targetCompatibility JavaVersion.VERSION_1_8 | |
} | |
kotlinOptions { | |
jvmTarget = '1.8' | |
} | |
} | |
dependencies { | |
implementation fileTree(dir: "libs", include: ["*.jar"]) | |
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.72" | |
implementation 'androidx.core:core-ktx:1.3.0' | |
implementation 'androidx.appcompat:appcompat:1.1.0' | |
implementation 'com.google.android.material:material:1.1.0' | |
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' | |
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2' | |
implementation 'androidx.navigation:navigation-ui-ktx:2.2.2' | |
testImplementation 'junit:junit:4.13' | |
androidTestImplementation 'androidx.test.ext:junit:1.1.1' | |
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' | |
} |
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
plugins { | |
id("com.android.application") | |
id("kotlin-android") | |
id("kotlin-android-extensions") | |
} | |
android { | |
compileSdkVersion(29) | |
buildToolsVersion = "29.0.3" | |
defaultConfig { | |
applicationId = "com.example.groovy2kotlin" | |
minSdkVersion(21) | |
targetSdkVersion(29) | |
versionCode = 1 | |
versionName = "1.0.0" | |
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | |
} | |
buildTypes { | |
named("release") { | |
isMinifyEnabled = false | |
proguardFiles( | |
getDefaultProguardFile("proguard-android-optimize.txt"), | |
"proguard-rules.pro" | |
) | |
} | |
} | |
compileOptions { | |
sourceCompatibility = JavaVersion.VERSION_1_8 | |
targetCompatibility = JavaVersion.VERSION_1_8 | |
} | |
kotlinOptions { | |
jvmTarget = "1.8" | |
} | |
} | |
dependencies { | |
implementation(fileTree("dir" to "libs", "include" to "*.jar")) | |
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.72") | |
implementation("androidx.core:core-ktx:1.3.0") | |
implementation("androidx.appcompat:appcompat:1.1.0") | |
implementation("com.google.android.material:material:1.1.0") | |
implementation("androidx.constraintlayout:constraintlayout:1.1.3") | |
implementation("androidx.navigation:navigation-fragment-ktx:2.2.2") | |
implementation("androidx.navigation:navigation-ui-ktx:2.2.2") | |
testImplementation("junit:junit:4.13") | |
androidTestImplementation("androidx.test.ext:junit:1.1.1") | |
androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") | |
} |
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
buildscript { | |
repositories { | |
google() | |
jcenter() | |
} | |
dependencies { | |
classpath "com.android.tools.build:gradle:4.0.0" | |
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72" | |
} | |
} | |
allprojects { | |
repositories { | |
google() | |
jcenter() | |
} | |
} | |
task clean(type: Delete) { | |
delete rootProject.buildDir | |
} |
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
buildscript { | |
repositories { | |
google() | |
jcenter() | |
} | |
dependencies { | |
classpath("com.android.tools.build:gradle:4.0.0") | |
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72") | |
} | |
} | |
allprojects { | |
repositories { | |
google() | |
jcenter() | |
} | |
} | |
tasks.register("clean", Delete::class) { | |
delete(rootProject.buildDir) | |
} |
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
rootProject.name = "Groovy2Kotlin" | |
include ':app' |
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
rootProject.name = "Groovy2Kotlin" | |
include(":app") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great! Thank you very much!