Skip to content

Commit

Permalink
Merge pull request #154 from instacart/kg/ref/version-catalog
Browse files Browse the repository at this point in the history
ref: move to using gradle version catalog
  • Loading branch information
kaushikgopal committed Apr 25, 2023
2 parents c3b67f2 + 0a7ff4d commit 54df116
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 37 deletions.
28 changes: 12 additions & 16 deletions app/build.gradle
@@ -1,16 +1,16 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
alias libs.plugins.android.application
alias libs.plugins.kotlin.android
}

android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileSdkVersion libs.versions.compileSdk.get().toInteger()

namespace 'com.instacart.sample'
defaultConfig {
applicationId "com.instacart.truetime"
minSdkVersion 14
targetSdkVersion rootProject.ext.targetSdkVersion
minSdkVersion libs.versions.minSdk.get()
targetSdkVersion libs.versions.targetSdk.get()

versionCode rootProject.ext.versionCode
versionName rootProject.ext.versionName
Expand Down Expand Up @@ -46,15 +46,11 @@ repositories {

dependencies {
implementation project(path: ':library')
// implementation 'com.github.instacart:truetime-android:4.0.0.alpha'
implementation 'com.github.instacart.truetime-android:library-extension-rx:3.5'

implementation "org.jetbrains.kotlin:kotlin-stdlib"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.0'

implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
// implementation(libs.truetime)
implementation(libs.truetime.rx)
implementation(libs.kotlin.stdlib)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.constraintlayout)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.rxjava.android)
}
21 changes: 6 additions & 15 deletions build.gradle
@@ -1,29 +1,20 @@
buildscript {
ext {
kotlin_version = '1.8.0'
coroutines_version = '1.6.4'
}

repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

plugins {
id "com.diffplug.spotless" version "6.15.0"

// alias for plugins that come from the version catalog file libs.versions.toml
// ...
alias(libs.plugins.spotless)

// id for plugins that don't come from the version catalog file
}

ext {
minSdkVersion = 9
targetSdkVersion = 33
compileSdkVersion = 33

versionCode = 12
versionName = '4.0.0.alpha'
}
Expand Down
37 changes: 37 additions & 0 deletions gradle/libs.versions.toml
@@ -0,0 +1,37 @@
[versions]
compileSdk = "33"
minSdk = "21"
targetSdk = "33"

androidGradlePlugin = "7.4.2"
androidxAppCompat = "1.6.1"
androidxLifecycle = "2.6.0"
constraintlayout = "2.1.4"
kotlin = "1.8.10"
kotlinxCoroutines = "1.6.4"
rxJava = "2.1.1"
spotless = "6.15.0"
trueTime = "4.0.0.alpha"
trueTimeRx = "3.5"

[libraries]

# Dependencies of the included build-logic
#android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" }
#kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }

androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidxAppCompat" }
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "androidxLifecycle" }
kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version.ref = "kotlin" }
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinxCoroutines" }
rxjava-android = { group = "io.reactivex.rxjava2", name = "rxandroid", version.ref = "rxJava" }
truetime = { group = "com.github.instacart", name = "truetime-android", version.ref = "trueTime" }
truetime-rx = { group = "com.github.instacart.truetime-android", name = "library-extension-rx", version.ref = "trueTimeRx" }


[plugins]
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
12 changes: 6 additions & 6 deletions library/build.gradle
@@ -1,19 +1,19 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
alias libs.plugins.android.library
alias libs.plugins.kotlin.android
id 'maven-publish'
}

android {
namespace = 'com.instacart.truetime'

compileSdkVersion rootProject.ext.compileSdkVersion
compileSdkVersion libs.versions.compileSdk.get().toInteger()

defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
minSdkVersion libs.versions.minSdk.get()
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aarMetadata {
minCompileSdk = rootProject.ext.compileSdkVersion
minCompileSdk = libs.versions.compileSdk.get().toInteger()
}
}

Expand All @@ -38,7 +38,7 @@ android {
}

dependencies {
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
api(libs.kotlinx.coroutines.core)
}

afterEvaluate {
Expand Down

0 comments on commit 54df116

Please sign in to comment.