Skip to content

Commit

Permalink
Add better wiring for build.gradle.kts files
Browse files Browse the repository at this point in the history
  • Loading branch information
rynkowsg committed Dec 21, 2021
1 parent 20bcf7f commit 2919002
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 16 deletions.
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
buildscript {
extra["buildConfig"] = mapOf(
"compileSdk" to 31,
"minSdk" to 25,
"targetSdk" to 30,
"buildTools" to "31.0.0"
"compileSdk" to AndroidConfig.COMPILE_SDK_VERSION,
"minSdk" to AndroidConfig.MIN_SDK_VERSION,
"targetSdk" to AndroidConfig.TARGET_SDK_VERSION,
"buildTools" to AndroidConfig.BUILD_TOOLS_VERSION
)
repositories {
google()
Expand Down
1 change: 1 addition & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import org.gradle.kotlin.dsl.`kotlin-dsl`

// The kotlin-dsl plugin requires a repository to be declared
repositories {
mavenCentral()
}
Expand Down
6 changes: 6 additions & 0 deletions buildSrc/src/main/kotlin/AndroidConfig.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
object AndroidConfig {
const val COMPILE_SDK_VERSION = 31
const val MIN_SDK_VERSION = 25
const val TARGET_SDK_VERSION = 30
const val BUILD_TOOLS_VERSION = "31.0.0"
}
8 changes: 8 additions & 0 deletions buildSrc/src/main/kotlin/GradlePluginId.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
object GradlePluginId {
const val ANDROID_APPLICATION = "com.android.application"
const val ANDROID_LIBRARY = "com.android.library"
const val KOTLIN_ANDROID = "org.jetbrains.kotlin.android"
const val KOTLIN_JVM = "org.jetbrains.kotlin.jvm"
const val KOTLIN_KAPT = "org.jetbrains.kotlin.kapt"
const val MAVEN_PUBLISH = "com.vanniktech.maven.publish"
}
8 changes: 4 additions & 4 deletions sample-firebase-config/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ plugins {
}

android {
compileSdkVersion buildConfig.compileSdk
buildToolsVersion buildConfig.buildTools
compileSdkVersion AndroidConfig.COMPILE_SDK_VERSION
buildToolsVersion AndroidConfig.BUILD_TOOLS_VERSION
defaultConfig {
applicationId "com.twobuffers.wire.sample_firebase_config"
minSdkVersion buildConfig.minSdk
targetSdkVersion buildConfig.targetSdk
minSdkVersion AndroidConfig.MIN_SDK_VERSION
targetSdkVersion AndroidConfig.TARGET_SDK_VERSION
versionCode 1000001
versionName "1.0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
8 changes: 4 additions & 4 deletions sample-firebase-messaging/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ kapt {
}

android {
compileSdkVersion buildConfig.compileSdk
buildToolsVersion buildConfig.buildTools
compileSdkVersion AndroidConfig.COMPILE_SDK_VERSION
buildToolsVersion AndroidConfig.BUILD_TOOLS_VERSION
defaultConfig {
applicationId "com.twobuffers.wire.sample_firebase_messaging"
minSdkVersion buildConfig.minSdk
targetSdkVersion buildConfig.targetSdk
minSdkVersion AndroidConfig.MIN_SDK_VERSION
targetSdkVersion AndroidConfig.TARGET_SDK_VERSION
versionCode 1000001
versionName "1.0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
8 changes: 4 additions & 4 deletions sample-initializer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ plugins {
}

android {
compileSdkVersion buildConfig.compileSdk
buildToolsVersion buildConfig.buildTools
compileSdkVersion AndroidConfig.COMPILE_SDK_VERSION
buildToolsVersion AndroidConfig.BUILD_TOOLS_VERSION
defaultConfig {
applicationId "com.twobuffers.wire.sample_initializer"
minSdkVersion buildConfig.minSdk
targetSdkVersion buildConfig.targetSdk
minSdkVersion AndroidConfig.MIN_SDK_VERSION
targetSdkVersion AndroidConfig.TARGET_SDK_VERSION
versionCode 1000001
versionName "1.0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down

0 comments on commit 2919002

Please sign in to comment.