Skip to content

Commit c961f9d

Browse files
author
Mikhail Fedotov
committed
Move build scripts to Kotlin DSL
1 parent 36e9911 commit c961f9d

13 files changed

+108
-180
lines changed

.gitignore

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
*.iml
22
.gradle
33
/local.properties
4-
/.idea/caches
5-
/.idea/libraries
6-
/.idea/modules.xml
7-
/.idea/workspace.xml
8-
/.idea/navEditor.xml
9-
/.idea/assetWizardSettings.xml
4+
/.idea
105
.DS_Store
116
/build
127
/captures

.idea/gradle.xml

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

.idea/jarRepositories.xml

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

.idea/misc.xml

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

app/build.gradle

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

app/build.gradle.kts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
plugins {
2+
id("com.android.application")
3+
kotlin("android")
4+
}
5+
6+
android {
7+
compileSdk = AppConfig.compileSdk
8+
buildToolsVersion = AppConfig.buildToolsVersion
9+
10+
defaultConfig {
11+
applicationId = "ru.nsk.kstatemachinesample"
12+
minSdk = AppConfig.minSdk
13+
targetSdk = AppConfig.targetSdk
14+
versionCode = AppConfig.versionCode
15+
versionName = AppConfig.versionName
16+
17+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
18+
}
19+
20+
buildTypes {
21+
getByName("release") {
22+
isMinifyEnabled = false
23+
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"))
24+
}
25+
}
26+
compileOptions {
27+
sourceCompatibility = JavaVersion.VERSION_11
28+
targetCompatibility = JavaVersion.VERSION_11
29+
}
30+
kotlinOptions {
31+
jvmTarget = "11"
32+
}
33+
buildFeatures {
34+
viewBinding = true
35+
}
36+
}
37+
38+
dependencies {
39+
implementation("androidx.core:core-ktx:${Versions.core}")
40+
implementation("androidx.appcompat:appcompat:${Versions.appcompat}")
41+
implementation("androidx.constraintlayout:constraintlayout:${Versions.constraintLayout}")
42+
implementation("androidx.lifecycle:lifecycle-livedata-ktx:${Versions.lifecycle}")
43+
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.lifecycle}")
44+
implementation("androidx.lifecycle:lifecycle-common-java8:${Versions.lifecycle}")
45+
implementation("androidx.startup:startup-runtime:${Versions.startup}")
46+
implementation("com.google.android.material:material:${Versions.material}")
47+
implementation("org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}")
48+
implementation("io.insert-koin:koin-androidx-viewmodel:${Versions.koin}")
49+
implementation("com.github.nsk90:kstatemachine:${Versions.kStateMachine}")
50+
}

build.gradle

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

build.gradle.kts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
buildscript {
3+
repositories {
4+
google()
5+
mavenCentral()
6+
}
7+
dependencies {
8+
classpath("com.android.tools.build:gradle:${Versions.gradle}")
9+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}")
10+
11+
// NOTE: Do not place your application dependencies here; they belong
12+
// in the individual module build.gradle files
13+
}
14+
}
15+
16+
allprojects {
17+
repositories {
18+
google()
19+
mavenCentral()
20+
maven { url = uri("https://jitpack.io") }
21+
}
22+
}
23+
24+
tasks.register<Delete>("clean") {
25+
delete(rootProject.buildDir)
26+
}

buildSrc/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

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+
mavenCentral()
7+
}

buildSrc/src/main/kotlin/AppConfig.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
object AppConfig {
2+
const val compileSdk = 31
3+
const val minSdk = 23
4+
const val targetSdk = 31
5+
const val versionCode = 2
6+
const val versionName = "1.0.1"
7+
const val buildToolsVersion = "31.0.0"
8+
}

buildSrc/src/main/kotlin/Versions.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
object Versions {
2+
const val kotlin = "1.6.10"
3+
const val gradle = "7.1.0"
4+
5+
// dependencies
6+
const val core = "1.7.0"
7+
const val appcompat = "1.4.1"
8+
const val constraintLayout = "2.1.3"
9+
const val koin = "2.2.2"
10+
const val lifecycle = "2.4.0"
11+
const val startup = "1.1.0"
12+
const val material = "1.5.0"
13+
const val kStateMachine = "0.9.0"
14+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
rootProject.name = "KStateMachine Sample"
2-
include ':app'
2+
include(":app")

0 commit comments

Comments
 (0)