Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Commit 1625e84

Browse files
author
Eduard Ablekimov
committed
Created buildSrc
1 parent 71ab9eb commit 1625e84

7 files changed

Lines changed: 102 additions & 53 deletions

File tree

app/build.gradle

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ apply plugin: 'com.android.application'
22
apply plugin: 'kotlin-android'
33

44
android {
5-
compileSdkVersion 29
5+
compileSdkVersion Config.compileSdk
66

77
defaultConfig {
88
applicationId "com.ackee.versionupdatehandler"
9-
minSdkVersion 15
10-
targetSdkVersion 29
9+
minSdkVersion Config.minSdk
10+
targetSdkVersion Config.targetSdk
1111
versionCode 1
1212
versionName "1.0"
1313
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -29,25 +29,17 @@ android {
2929
}
3030
}
3131

32-
ext {
33-
ankoVersion = "0.10.8"
34-
}
35-
3632
dependencies {
3733
implementation fileTree(dir: 'libs', include: ['*.jar'])
3834
implementation project(':status-resolver')
3935

40-
implementation 'androidx.appcompat:appcompat:1.1.0'
41-
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
42-
43-
// Anko
44-
implementation "org.jetbrains.anko:anko-sdk15:$ankoVersion" // So here it's 15 too
45-
implementation "org.jetbrains.anko:anko-sdk21-coroutines:$ankoVersion"
46-
47-
// Anko libs matching support libs
48-
implementation "org.jetbrains.anko:anko-appcompat-v7:${ankoVersion}"
36+
implementation Dependencies.androidXAppCompat
37+
implementation Dependencies.kotlinStdLib
38+
implementation Dependencies.ankoSdk15
39+
implementation Dependencies.ankoSdk21Coroutines
40+
implementation Dependencies.ankoAppcompat
4941

50-
testImplementation 'junit:junit:4.13'
42+
testImplementation Dependencies.jUnit
5143
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
5244
exclude group: 'com.android.support', module: 'support-annotations'
5345
})

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.kotlin_version = '1.3.72'
4+
ext.kotlin_version = Config.kotlinVersion
55

66
repositories {
77
jcenter()

buildSrc/build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import org.gradle.kotlin.dsl.`kotlin-dsl`
2+
3+
plugins {
4+
`kotlin-dsl`
5+
}
6+
// Required since Gradle 4.10+.
7+
repositories {
8+
jcenter()
9+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
object Config {
2+
const val kotlinVersion = "1.3.72"
3+
4+
const val minSdk = 15
5+
const val compileSdk = 29
6+
const val targetSdk = 29
7+
}
8+
9+
object Dependencies {
10+
11+
// Kotlin
12+
private const val kotlinCoroutinesVersion = "1.3.7"
13+
const val kotlinStdLib = "org.jetbrains.kotlin:kotlin-stdlib:${Config.kotlinVersion}"
14+
const val kotlinStdLibJdk7 = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Config.kotlinVersion}"
15+
const val kotlinCoroutinesCore = "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesVersion"
16+
const val kotlinCoroutinesAndroid = "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinCoroutinesVersion"
17+
const val kotlinCoroutinesPlayServices = "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$kotlinCoroutinesVersion"
18+
19+
// AndroidX
20+
private const val androidXVersion = "1.1.0"
21+
const val androidXAppCompat = "androidx.appcompat:appcompat:$androidXVersion"
22+
23+
// Core Ktx
24+
private const val coreKtxVersion = "1.3.0"
25+
const val coreKtx = "androidx.core:core-ktx:$coreKtxVersion"
26+
27+
// Firebase
28+
private const val firebaseConfigVersion = "19.1.4"
29+
const val firebaseConfig = "com.google.firebase:firebase-config:$firebaseConfigVersion"
30+
31+
// Retrofit
32+
private const val retrofitVersion = "2.9.0"
33+
const val retrofit = "com.squareup.retrofit2:retrofit:$retrofitVersion"
34+
const val retrofitConverterGson = "com.squareup.retrofit2:converter-gson:$retrofitVersion"
35+
36+
// Anko
37+
private const val ankoVersion = "0.10.8"
38+
const val ankoSdk15 = "org.jetbrains.anko:anko-sdk15:$ankoVersion"
39+
const val ankoSdk21Coroutines = "org.jetbrains.anko:anko-sdk21-coroutines:$ankoVersion"
40+
const val ankoAppcompat = "org.jetbrains.anko:anko-appcompat-v7:$ankoVersion"
41+
42+
// JUnit
43+
private const val jUnitVersion = "4.13"
44+
const val jUnit = "junit:junit:$jUnitVersion"
45+
46+
// Truth
47+
private const val truthVersion = "1.0.1"
48+
const val truth = "com.google.truth:truth:$truthVersion"
49+
50+
// MockWebServer
51+
private const val mockWebServerVersion = "4.7.2"
52+
const val mockWebServer = "com.squareup.okhttp3:mockwebserver:$mockWebServerVersion"
53+
}

firebase-fetcher/build.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ apply plugin: 'com.android.library'
22
apply plugin: 'kotlin-android'
33

44
android {
5-
compileSdkVersion 29
5+
compileSdkVersion Config.compileSdk
66

77
defaultConfig {
8-
minSdkVersion 15
9-
targetSdkVersion 29
8+
minSdkVersion Config.minSdk
9+
targetSdkVersion Config.targetSdk
1010
versionCode properties['VERSION_CODE']
1111
versionName properties['VERSION_NAME']
1212
}
@@ -21,12 +21,12 @@ android {
2121
dependencies {
2222
implementation project(':status-resolver')
2323

24-
implementation 'com.google.firebase:firebase-config:19.1.4'
25-
implementation "androidx.core:core-ktx:1.3.0"
26-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
27-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.3.7"
24+
implementation Dependencies.firebaseConfig
25+
implementation Dependencies.coreKtx
26+
implementation Dependencies.kotlinStdLibJdk7
27+
implementation Dependencies.kotlinCoroutinesPlayServices
2828

29-
testImplementation 'junit:junit:4.13'
29+
testImplementation Dependencies.jUnit
3030
}
3131

3232
ext {

rest-fetcher/build.gradle

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ apply plugin: 'com.android.library'
22
apply plugin: 'kotlin-android'
33

44
android {
5-
compileSdkVersion 29
5+
compileSdkVersion Config.compileSdk
66

77
defaultConfig {
8-
minSdkVersion 15
9-
targetSdkVersion 29
8+
minSdkVersion Config.minSdk
9+
targetSdkVersion Config.targetSdk
1010
versionCode properties['VERSION_CODE']
1111
versionName properties['VERSION_NAME']
1212

@@ -24,16 +24,15 @@ android {
2424
dependencies {
2525
implementation project(':status-resolver')
2626

27-
implementation 'com.squareup.retrofit2:retrofit:2.7.2'
28-
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
29-
implementation 'com.squareup.okhttp3:logging-interceptor:4.4.0'
30-
implementation "androidx.core:core-ktx:1.3.0"
31-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
32-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7'
27+
implementation Dependencies.retrofit
28+
implementation Dependencies.retrofitConverterGson
29+
implementation Dependencies.coreKtx
30+
implementation Dependencies.kotlinStdLibJdk7
31+
implementation Dependencies.kotlinCoroutinesCore
3332

34-
testImplementation 'junit:junit:4.13'
35-
testImplementation "com.google.truth:truth:1.0.1"
36-
testImplementation "com.squareup.okhttp3:mockwebserver:4.7.2"
33+
testImplementation Dependencies.jUnit
34+
testImplementation Dependencies.truth
35+
testImplementation Dependencies.mockWebServer
3736
}
3837

3938
ext {

status-resolver/build.gradle

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ apply plugin: 'kotlin-android'
33
apply plugin: 'kotlin-android-extensions'
44

55
android {
6-
compileSdkVersion 29
6+
compileSdkVersion Config.compileSdk
77

88
defaultConfig {
9-
minSdkVersion 15
10-
targetSdkVersion 29
9+
minSdkVersion Config.minSdk
10+
targetSdkVersion Config.targetSdk
1111
versionCode properties['VERSION_CODE']
1212
versionName properties['VERSION_NAME']
1313

@@ -25,19 +25,15 @@ android {
2525
}
2626
}
2727

28-
ext {
29-
kotlin_coroutines_version = "1.3.7"
30-
}
31-
3228
dependencies {
33-
implementation 'androidx.appcompat:appcompat:1.1.0'
34-
implementation "androidx.core:core-ktx:1.3.0"
35-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
36-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
37-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"
38-
39-
testImplementation "com.google.truth:truth:1.0.1"
40-
testImplementation 'junit:junit:4.13'
29+
implementation Dependencies.androidXAppCompat
30+
implementation Dependencies.coreKtx
31+
implementation Dependencies.kotlinStdLibJdk7
32+
implementation Dependencies.kotlinCoroutinesCore
33+
implementation Dependencies.kotlinCoroutinesAndroid
34+
35+
testImplementation Dependencies.truth
36+
testImplementation Dependencies.jUnit
4137
}
4238

4339
ext {

0 commit comments

Comments
 (0)