Skip to content

Commit 9d3440f

Browse files
dbaelzmaestromac
authored andcommitted
Migrate to Gradle Kotlin DSL (#41)
1 parent 4da8945 commit 9d3440f

File tree

14 files changed

+202
-181
lines changed

14 files changed

+202
-181
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ out/
1616

1717
# Gradle files
1818
.gradle/
19-
build/
19+
/build
20+
/buildSrc/build
2021

2122
# Local configuration file (sdk path, etc)
2223
local.properties

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Like many open source projects, we require that contributors provide us with a C
3737

3838
Our version of the CLA was adapted from the Microsoft Contributor License Agreement, which they generously made available to the public domain under Creative Commons CC0 1.0 Universal.
3939

40-
Any questions, please refer to our [license FAQ](http://docs.dev.to/license-faq/) doc or email [email protected]
40+
Any questions, please refer to our [license FAQ](https://docs.dev.to/licensing/) doc or email [email protected]
4141

4242
<br/>
4343

app/build.gradle

Lines changed: 0 additions & 48 deletions
This file was deleted.

app/build.gradle.kts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import to.dev.dev_android.build.BuildConfig
2+
3+
plugins {
4+
id("com.android.application")
5+
id("kotlin-android")
6+
id("kotlin-android-extensions")
7+
}
8+
9+
android {
10+
compileSdkVersion(BuildConfig.compileSdkVersion)
11+
defaultConfig {
12+
applicationId = "to.dev.dev_android"
13+
minSdkVersion(BuildConfig.minSdkVersion)
14+
targetSdkVersion(BuildConfig.targetSdkVersion)
15+
versionCode = 4
16+
versionName = "1.2"
17+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
18+
}
19+
buildTypes {
20+
getByName("release") {
21+
isMinifyEnabled = false
22+
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
23+
}
24+
getByName("debug") {
25+
applicationIdSuffix = ".debug"
26+
isDebuggable = true
27+
}
28+
}
29+
dataBinding {
30+
isEnabled = true
31+
}
32+
33+
compileOptions {
34+
sourceCompatibility = JavaVersion.VERSION_1_8
35+
targetCompatibility = JavaVersion.VERSION_1_8
36+
}
37+
}
38+
39+
dependencies {
40+
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
41+
implementation(project(path = ":baseui"))
42+
43+
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${BuildConfig.kotlinVersion}")
44+
implementation("androidx.browser:browser:1.0.0")
45+
46+
testImplementation("junit:junit:4.12")
47+
androidTestImplementation("androidx.test:runner:1.2.0")
48+
androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0")
49+
}

baseui/build.gradle

Lines changed: 0 additions & 53 deletions
This file was deleted.

baseui/build.gradle.kts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import to.dev.dev_android.build.BuildConfig
2+
3+
plugins {
4+
id("com.android.library")
5+
id("kotlin-android")
6+
id("kotlin-android-extensions")
7+
}
8+
9+
android {
10+
compileSdkVersion(BuildConfig.compileSdkVersion)
11+
defaultConfig {
12+
minSdkVersion(BuildConfig.minSdkVersion)
13+
targetSdkVersion(BuildConfig.targetSdkVersion)
14+
versionCode = 1
15+
versionName = "1.0"
16+
17+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
18+
}
19+
20+
buildTypes {
21+
getByName("debug") {
22+
resValue("string", "baseUrl", "\"https://dev.to\"")
23+
buildConfigField("String", "baseUrl", "\"https://dev.to\"")
24+
}
25+
getByName("release") {
26+
isMinifyEnabled = false
27+
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
28+
resValue("string", "baseUrl", "\"https://dev.to\"")
29+
buildConfigField("String", "baseUrl", "\"https://dev.to\"")
30+
}
31+
}
32+
33+
dataBinding {
34+
isEnabled = true
35+
}
36+
37+
compileOptions {
38+
sourceCompatibility = JavaVersion.VERSION_1_8
39+
targetCompatibility = JavaVersion.VERSION_1_8
40+
}
41+
}
42+
43+
dependencies {
44+
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
45+
46+
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${BuildConfig.kotlinVersion}")
47+
api("androidx.appcompat:appcompat:1.0.2")
48+
api("androidx.constraintlayout:constraintlayout:1.1.3")
49+
api("androidx.lifecycle:lifecycle-extensions:2.0.0")
50+
api("androidx.lifecycle:lifecycle-viewmodel:2.0.0")
51+
52+
testImplementation("junit:junit:4.12")
53+
androidTestImplementation("androidx.test:runner:1.2.0")
54+
androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0")
55+
}

build.gradle

Lines changed: 0 additions & 34 deletions
This file was deleted.

build.gradle.kts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
3+
buildscript {
4+
repositories {
5+
google()
6+
jcenter()
7+
}
8+
dependencies {
9+
classpath("com.android.tools.build:gradle:3.4.1")
10+
// Due an issue the full qualified name is required here. See https://github.com/gradle/kotlin-dsl/issues/1291
11+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${to.dev.dev_android.build.BuildConfig.kotlinVersion}")
12+
13+
// NOTE: Do not place your application dependencies here; they belong
14+
// in the individual module build.gradle files
15+
}
16+
}
17+
18+
allprojects {
19+
repositories {
20+
google()
21+
jcenter()
22+
}
23+
}
24+
25+
tasks.wrapper {
26+
gradleVersion = "5.4.1"
27+
distributionType = Wrapper.DistributionType.ALL
28+
}
29+
30+
task("clean") {
31+
delete(rootProject.buildDir)
32+
}

buildSrc/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
repositories {
6+
jcenter()
7+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package to.dev.dev_android.build
2+
3+
object BuildConfig {
4+
const val kotlinVersion = "1.3.31"
5+
6+
const val minSdkVersion = 18
7+
const val targetSdkVersion = 28
8+
const val compileSdkVersion = targetSdkVersion
9+
}

0 commit comments

Comments
 (0)