Skip to content

Commit

Permalink
Migrate buildSrc to Version Catalog (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
fornewid authored Feb 15, 2022
1 parent ac89808 commit da23842
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 102 deletions.
13 changes: 8 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import dependencies.Libs

buildscript {
ext.buildConfig = [
'minSdk' : 21,
'targetSdk' : 30,
'compileSdk': 30
]
repositories {
google()
mavenCentral()
}
dependencies {
classpath Libs.androidGradlePlugin
classpath Libs.Kotlin.plugin
classpath Libs.AndroidX.Benchmark.plugin
classpath libs.android.pluginGradle
classpath libs.kotlin.pluginGradle
classpath libs.androidx.benchmark.pluginGradle
}
}

Expand Down
8 changes: 0 additions & 8 deletions buildSrc/build.gradle.kts

This file was deleted.

39 changes: 0 additions & 39 deletions buildSrc/src/main/java/dependencies/Dependencies.kt

This file was deleted.

23 changes: 23 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[versions]

kotlin = "1.3.72"
benchmark = "1.0.0"

[libraries]

android-pluginGradle = "com.android.tools.build:gradle:7.1.0"

kotlin-pluginGradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk7", version.ref = "kotlin" }

androidx-appcompat = "androidx.appcompat:appcompat:1.2.0"
androidx-constraintlayout = "androidx.constraintlayout:constraintlayout:2.0.4"
androidx-core = "androidx.core:core-ktx:1.3.2"
androidx-recyclerview = "androidx.recyclerview:recyclerview:1.1.0"

androidx-benchmark-pluginGradle = { module = "androidx.benchmark:benchmark-gradle-plugin", version.ref = "benchmark" }
androidx-benchmark-junit4 = { module = "androidx.benchmark:benchmark-junit4", version.ref = "benchmark" }

androidx-test-runner = "androidx.test:runner:1.2.0"
androidx-test-junit = "androidx.test.ext:junit:1.1.1"
test-junit = "junit:junit:4.12"
13 changes: 5 additions & 8 deletions neumorphism/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import dependencies.Libs
import dependencies.Versions

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'maven-publish'

android {
compileSdkVersion Versions.compileSdk
compileSdkVersion buildConfig.compileSdk
defaultConfig {
minSdkVersion Versions.minSdk
targetSdkVersion Versions.targetSdk
minSdkVersion buildConfig.minSdk
targetSdkVersion buildConfig.targetSdk
consumerProguardFiles 'consumer-rules.pro'
}
compileOptions {
Expand All @@ -22,8 +19,8 @@ android {
}

dependencies {
implementation Libs.Kotlin.stdlib
implementation Libs.AndroidX.appcompat
implementation libs.kotlin.stdlib
implementation libs.androidx.appcompat
}

afterEvaluate {
Expand Down
21 changes: 9 additions & 12 deletions sample-app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import dependencies.Libs
import dependencies.Versions

plugins {
id 'com.android.application'
id 'kotlin-android'
}

android {
compileSdkVersion Versions.compileSdk
compileSdkVersion buildConfig.compileSdk
defaultConfig {
applicationId "soup.neumorphism.sample"
minSdkVersion Versions.minSdk
targetSdkVersion Versions.targetSdk
minSdkVersion buildConfig.minSdk
targetSdkVersion buildConfig.targetSdk
versionCode 1
versionName "1.0"
}
buildFeatures {
viewBinding = true
viewBinding true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -30,9 +27,9 @@ android {
dependencies {
implementation project(":neumorphism")
implementation project(":sample-ui")
implementation Libs.Kotlin.stdlib
implementation Libs.AndroidX.appcompat
implementation Libs.AndroidX.constraintlayout
implementation Libs.AndroidX.core_ktx
implementation Libs.AndroidX.recyclerview
implementation libs.kotlin.stdlib
implementation libs.androidx.appcompat
implementation libs.androidx.constraintlayout
implementation libs.androidx.core
implementation libs.androidx.recyclerview
}
28 changes: 12 additions & 16 deletions sample-benchmark/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import dependencies.Libs
import dependencies.Versions

plugins {
id 'com.android.library'
id 'androidx.benchmark'
id 'kotlin-android'
}

android {
compileSdkVersion Versions.compileSdk

compileSdkVersion buildConfig.compileSdk
defaultConfig {
minSdkVersion Versions.minSdk
targetSdkVersion Versions.targetSdk
minSdkVersion buildConfig.minSdk
targetSdkVersion buildConfig.targetSdk
versionCode 1
versionName "1.0"

Expand Down Expand Up @@ -43,14 +39,14 @@ android {
dependencies {
implementation project(":neumorphism")
implementation project(":sample-ui")
implementation Libs.Kotlin.stdlib
androidTestImplementation Libs.Test.junit
androidTestImplementation Libs.AndroidX.Test.runner
androidTestImplementation Libs.AndroidX.Test.junit
androidTestImplementation Libs.AndroidX.Benchmark.junit4
implementation libs.kotlin.stdlib
androidTestImplementation libs.test.junit
androidTestImplementation libs.androidx.test.runner
androidTestImplementation libs.androidx.test.junit
androidTestImplementation libs.androidx.benchmark.junit4

androidTestImplementation Libs.AndroidX.appcompat
androidTestImplementation Libs.AndroidX.constraintlayout
androidTestImplementation Libs.AndroidX.core_ktx
androidTestImplementation Libs.AndroidX.recyclerview
androidTestImplementation libs.androidx.appcompat
androidTestImplementation libs.androidx.constraintlayout
androidTestImplementation libs.androidx.core
androidTestImplementation libs.androidx.recyclerview
}
22 changes: 9 additions & 13 deletions sample-ui/build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
import dependencies.Libs
import dependencies.Versions

plugins {
id 'com.android.library'
id 'kotlin-android'
}

android {
compileSdkVersion Versions.compileSdk

compileSdkVersion buildConfig.compileSdk
defaultConfig {
minSdkVersion Versions.minSdk
targetSdkVersion Versions.targetSdk
minSdkVersion buildConfig.minSdk
targetSdkVersion buildConfig.targetSdk

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildFeatures {
viewBinding = true
viewBinding true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -30,9 +26,9 @@ android {

dependencies {
implementation project(":neumorphism")
implementation Libs.Kotlin.stdlib
implementation Libs.AndroidX.appcompat
implementation Libs.AndroidX.constraintlayout
implementation Libs.AndroidX.core_ktx
implementation Libs.AndroidX.recyclerview
implementation libs.kotlin.stdlib
implementation libs.androidx.appcompat
implementation libs.androidx.constraintlayout
implementation libs.androidx.core
implementation libs.androidx.recyclerview
}
5 changes: 4 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
rootProject.name='Neumorphism'
include ':neumorphism'
include ':sample-app'
include ':sample-benchmark'
include ':sample-ui'

// Enable Gradle's version catalog support
// https://docs.gradle.org/current/userguide/platforms.html
enableFeaturePreview("VERSION_CATALOGS")

0 comments on commit da23842

Please sign in to comment.