Skip to content

Commit

Permalink
Change to version catalogs (#214)
Browse files Browse the repository at this point in the history
Adopt version catalogs and temporarily use the littlerobots upgrade plugin.
  • Loading branch information
yschimke authored Feb 18, 2022
1 parent 6c707ce commit d16fa81
Show file tree
Hide file tree
Showing 68 changed files with 1,587 additions and 452 deletions.
28 changes: 22 additions & 6 deletions AlwaysOnKotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ buildscript {
}

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

plugins {
id 'com.diffplug.spotless' version '6.0.1'
id "com.diffplug.spotless" version "6.0.1"
id "com.github.ben-manes.versions" version "0.41.0"

This comment has been minimized.

Copy link
@nikhil3458

nikhil3458 Dec 7, 2023

"id "com.github.ben-manes.versions" version "0.41.0"" Try changing it 1.30.0

This comment has been minimized.

Copy link
@yschimke

yschimke Dec 7, 2023

Author Contributor

It's now been removed.

id "nl.littlerobots.version-catalog-update" version "0.3.0"
}

subprojects {
Expand All @@ -41,12 +43,26 @@ subprojects {

spotless {
kotlin {
target '**/*.kt'
target "**/*.kt"
targetExclude("$buildDir/**/*.kt")
targetExclude('bin/**/*.kt')
targetExclude("bin/**/*.kt")

ktlint("0.41.0")
licenseHeaderFile rootProject.file('spotless/copyright.kt')
licenseHeaderFile rootProject.file("spotless/copyright.kt")
}
}
}

tasks.named("dependencyUpdates").configure {
rejectVersionIf {
(it.candidate.version ==~ /.*-alpha.*/ && !(it.currentVersion ==~ /.*-alpha.*/)) ||
(it.candidate.version ==~ /.*-beta.*/ && !(it.currentVersion ==~ /.*-(beta|alpha).*/)) ||
(it.candidate.version ==~ /.*1.6.20-M.*/)
}
}

versionCatalogUpdate {
keep {
keepUnusedVersions = true
}
}
44 changes: 22 additions & 22 deletions AlwaysOnKotlin/compose/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ android {
defaultConfig {
versionCode 1
versionName "1.0"
minSdkVersion 26
targetSdkVersion 30
minSdk 26
targetSdk 30

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

lintOptions {
warningsAsErrors true
ignore "OldTargetApi" // API >30 doesn't exist for Wear OS
ignore "OldTargetApi" // API >30 doesn"t exist for Wear OS
}

compileOptions {
Expand All @@ -52,7 +52,7 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion '1.1.0-rc02'
kotlinCompilerExtensionVersion "1.1.0-rc02"
}

// Workaround for https://github.com/Kotlin/kotlinx.coroutines/issues/2023
Expand All @@ -64,23 +64,23 @@ android {
}

dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0"
implementation "androidx.activity:activity-compose:1.4.0"
implementation 'androidx.compose.ui:ui:1.1.0-rc01'
implementation 'androidx.compose.ui:ui-tooling:1.1.0-rc01'
implementation 'androidx.compose.compiler:compiler:1.1.0-rc02'
implementation "androidx.core:core-ktx:1.7.0"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0"
implementation 'androidx.wear:wear:1.2.0'
implementation "androidx.wear.compose:compose-foundation:1.0.0-alpha13"
implementation "androidx.wear.compose:compose-material:1.0.0-alpha13"
implementation "androidx.window:window:1.0.0-rc01"
implementation "androidx.compose.ui:ui-test-manifest:1.1.0-rc01"
implementation libs.kotlinx.coroutines.android
implementation libs.androidx.activity.compose
implementation libs.compose.ui
implementation libs.compose.ui.tooling
implementation libs.compose.compiler
implementation libs.androidx.core.ktx
implementation libs.androidx.lifecycle.runtime.ktx
implementation libs.androidx.wear
implementation libs.wear.compose.foundation
implementation libs.wear.compose.material
implementation libs.androidx.window
implementation libs.compose.ui.test.manifest

androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0"
androidTestImplementation "androidx.test:core-ktx:1.4.0"
androidTestImplementation "androidx.test.ext:junit-ktx:1.1.3"
androidTestImplementation "androidx.test:runner:1.4.0"
androidTestImplementation "androidx.test.uiautomator:uiautomator:2.2.0"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.1.0-rc01"
androidTestImplementation libs.kotlinx.coroutines.test
androidTestImplementation libs.test.core.ktx
androidTestImplementation libs.test.ext.junit.ktx
androidTestImplementation libs.test.runner
androidTestImplementation libs.test.uiautomator
androidTestImplementation libs.compose.ui.test.junit4
}
93 changes: 93 additions & 0 deletions AlwaysOnKotlin/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
[versions]
androidx-activity = "1.4.0"
compose-ui = "1.1.0-rc01"
androidx-test = "1.4.0"
androidx-wear-compose = "1.0.0-alpha13"
org-jetbrains-kotlinx = "1.6.0"

[libraries]
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity" }
androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "androidx-activity" }
compose-compiler = "androidx.compose.compiler:compiler:1.1.0-rc02"
compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose-ui" }
compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "compose-ui" }
compose-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "compose-ui" }
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose-ui" }
androidx-core-ktx = "androidx.core:core-ktx:1.7.0"
androidx-databinding-viewbinding = "androidx.databinding:viewbinding:7.0.4"
androidx-lifecycle-runtime-ktx = "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0"
test-core = { module = "androidx.test:core", version.ref = "androidx-test" }
test-core-ktx = { module = "androidx.test:core-ktx", version.ref = "androidx-test" }
test-espresso-core = "androidx.test.espresso:espresso-core:3.4.0"
test-ext-junit = "androidx.test.ext:junit:1.1.3"
test-ext-junit-ktx = "androidx.test.ext:junit-ktx:1.1.3"
test-ext-truth = "androidx.test.ext:truth:1.4.0"
test-rules = { module = "androidx.test:rules", version.ref = "androidx-test" }
test-runner = { module = "androidx.test:runner", version.ref = "androidx-test" }
test-uiautomator = "androidx.test.uiautomator:uiautomator:2.2.0"
androidx-wear = "androidx.wear:wear:1.2.0"
wear-compose-foundation = { module = "androidx.wear.compose:compose-foundation", version.ref = "androidx-wear-compose" }
wear-compose-material = { module = "androidx.wear.compose:compose-material", version.ref = "androidx-wear-compose" }
androidx-window = "androidx.window:window:1.0.0-rc01"
android-build-gradle = "com.android.tools.build:gradle:7.0.4"
android-lint-gradle = "com.android.tools.lint:lint-gradle:30.0.4"
com-google-truth = "com.google.truth:truth:1.1.2"
jacoco-ant = "org.jacoco:org.jacoco.ant:0.8.3"
kotlin-gradle-plugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "org-jetbrains-kotlinx" }
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "org-jetbrains-kotlinx" }

[plugins]
android = "android:7.0.4"
android-library = "android-library:7.0.4"
android-reporting = "android-reporting:7.0.4"
com-android-application = "com.android.application:7.0.4"
com-android-asset-pack = "com.android.asset-pack:7.0.4"
com-android-asset-pack-bundle = "com.android.asset-pack-bundle:7.0.4"
com-android-base = "com.android.base:7.0.4"
com-android-dynamic-feature = "com.android.dynamic-feature:7.0.4"
com-android-internal-application = "com.android.internal.application:7.0.4"
com-android-internal-asset-pack = "com.android.internal.asset-pack:7.0.4"
com-android-internal-asset-pack-bundle = "com.android.internal.asset-pack-bundle:7.0.4"
com-android-internal-dynamic-feature = "com.android.internal.dynamic-feature:7.0.4"
com-android-internal-library = "com.android.internal.library:7.0.4"
com-android-internal-reporting = "com.android.internal.reporting:7.0.4"
com-android-internal-test = "com.android.internal.test:7.0.4"
com-android-internal-version-check = "com.android.internal.version-check:7.0.4"
com-android-library = "com.android.library:7.0.4"
com-android-lint = "com.android.lint:7.0.4"
com-android-reporting = "com.android.reporting:7.0.4"
com-android-test = "com.android.test:7.0.4"
com-diffplug-spotless = "com.diffplug.spotless:6.0.1"
com-github-ben-manes-versions = "com.github.ben-manes.versions:0.41.0"
kotlin = "kotlin:1.6.10"
kotlin-android = "kotlin-android:1.6.10"
kotlin-android-extensions = "kotlin-android-extensions:1.6.10"
kotlin-dce-js = "kotlin-dce-js:1.6.10"
kotlin-kapt = "kotlin-kapt:1.6.10"
kotlin-multiplatform = "kotlin-multiplatform:1.6.10"
kotlin-native-cocoapods = "kotlin-native-cocoapods:1.6.10"
kotlin-native-performance = "kotlin-native-performance:1.6.10"
kotlin-parcelize = "kotlin-parcelize:1.6.10"
kotlin-platform-android = "kotlin-platform-android:1.6.10"
kotlin-platform-common = "kotlin-platform-common:1.6.10"
kotlin-platform-js = "kotlin-platform-js:1.6.10"
kotlin-platform-jvm = "kotlin-platform-jvm:1.6.10"
kotlin-scripting = "kotlin-scripting:1.6.10"
kotlin2js = "kotlin2js:1.6.10"
nl-littlerobots-version-catalog-update = "nl.littlerobots.version-catalog-update:0.3.0"
org-jetbrains-kotlin-android = "org.jetbrains.kotlin.android:1.6.10"
org-jetbrains-kotlin-android-extensions = "org.jetbrains.kotlin.android.extensions:1.6.10"
org-jetbrains-kotlin-js = "org.jetbrains.kotlin.js:1.6.10"
org-jetbrains-kotlin-jvm = "org.jetbrains.kotlin.jvm:1.6.10"
org-jetbrains-kotlin-kapt = "org.jetbrains.kotlin.kapt:1.6.10"
org-jetbrains-kotlin-multiplatform = "org.jetbrains.kotlin.multiplatform:1.6.10"
org-jetbrains-kotlin-multiplatform-pm20 = "org.jetbrains.kotlin.multiplatform.pm20:1.6.10"
org-jetbrains-kotlin-native-cocoapods = "org.jetbrains.kotlin.native.cocoapods:1.6.10"
org-jetbrains-kotlin-native-performance = "org.jetbrains.kotlin.native.performance:1.6.10"
org-jetbrains-kotlin-platform-android = "org.jetbrains.kotlin.platform.android:1.6.10"
org-jetbrains-kotlin-platform-common = "org.jetbrains.kotlin.platform.common:1.6.10"
org-jetbrains-kotlin-platform-js = "org.jetbrains.kotlin.platform.js:1.6.10"
org-jetbrains-kotlin-platform-jvm = "org.jetbrains.kotlin.platform.jvm:1.6.10"
org-jetbrains-kotlin-plugin-parcelize = "org.jetbrains.kotlin.plugin.parcelize:1.6.10"
org-jetbrains-kotlin-plugin-scripting = "org.jetbrains.kotlin.plugin.scripting:1.6.10"
2 changes: 1 addition & 1 deletion AlwaysOnKotlin/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
7 changes: 5 additions & 2 deletions AlwaysOnKotlin/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
* limitations under the License.
*/

include ':compose'
include ':views'
include ":compose"
include ":views"

// https://docs.gradle.org/7.4/userguide/declaring_dependencies.html#sec:type-safe-project-accessors
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
36 changes: 18 additions & 18 deletions AlwaysOnKotlin/views/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ android {
defaultConfig {
versionCode 1
versionName "1.0"
minSdkVersion 26
targetSdkVersion 30
minSdk 26
targetSdk 30

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

lintOptions {
warningsAsErrors true
ignore "OldTargetApi" // API >30 doesn't exist for Wear OS
ignore "OldTargetApi" // API >30 doesn"t exist for Wear OS
}

compileOptions {
Expand All @@ -60,20 +60,20 @@ android {
}

dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0"
implementation "androidx.activity:activity-ktx:1.4.0"
implementation "androidx.core:core-ktx:1.7.0"
implementation 'androidx.wear:wear:1.2.0'
implementation libs.kotlinx.coroutines.android
implementation libs.androidx.activity.ktx
implementation libs.androidx.core.ktx
implementation libs.androidx.wear

androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0"
androidTestImplementation "androidx.test:core:1.4.0"
androidTestImplementation "androidx.test:core-ktx:1.4.0"
androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
androidTestImplementation "androidx.test.ext:junit:1.1.3"
androidTestImplementation "androidx.test.ext:junit-ktx:1.1.3"
androidTestImplementation "androidx.test.ext:truth:1.4.0"
androidTestImplementation "androidx.test:runner:1.4.0"
androidTestImplementation "androidx.test:rules:1.4.0"
androidTestImplementation "androidx.test.uiautomator:uiautomator:2.2.0"
androidTestImplementation "com.google.truth:truth:1.1.2"
androidTestImplementation libs.kotlinx.coroutines.test
androidTestImplementation libs.test.core
androidTestImplementation libs.test.core.ktx
androidTestImplementation libs.test.espresso.core
androidTestImplementation libs.test.ext.junit
androidTestImplementation libs.test.ext.junit.ktx
androidTestImplementation libs.test.ext.truth
androidTestImplementation libs.test.runner
androidTestImplementation libs.test.rules
androidTestImplementation libs.test.uiautomator
androidTestImplementation libs.com.google.truth
}
42 changes: 21 additions & 21 deletions ComposeAdvanced/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/
plugins {
id 'com.android.application'
id 'kotlin-android'
id "com.android.application"
id "kotlin-android"
}

android {
Expand All @@ -32,15 +32,15 @@ android {
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = "1.8"
useIR = true
freeCompilerArgs += "-Xjvm-default=compatibility"
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
Expand All @@ -57,27 +57,27 @@ android {
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

dependencies {
// General compose dependencies
implementation "androidx.activity:activity-compose:$activity_compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation "androidx.compose.compiler:compiler:$compose_version"
implementation "androidx.compose.foundation:foundation:$compose_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version"
implementation libs.androidx.activity.compose
implementation libs.compose.ui.tooling.preview
implementation libs.compose.compiler
implementation libs.compose.foundation
implementation libs.androidx.lifecycle.viewmodel.compose

// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation libs.androidx.lifecycle.viewmodel.ktx

// Saved state module for ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"
implementation libs.androidx.lifecycle.viewmodel.savedstate

// Annotation processor
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
implementation libs.androidx.lifecycle.common.java8


// Compose for Wear OS Dependencies
Expand All @@ -87,19 +87,19 @@ dependencies {
// androidx.compose.material:material. If there are features from that you feel are missing from
// androidx.wear.compose:compose-material please raise a bug to let us know:
// https://issuetracker.google.com/issues/new?component=1077552&template=1598429&pli=1
implementation "androidx.wear.compose:compose-material:$wear_compose_version"
implementation libs.wear.compose.material

// Foundation is additive, so you can use the mobile version in your Wear OS app.
implementation "androidx.wear.compose:compose-foundation:$wear_compose_version"
implementation libs.wear.compose.foundation

// If you are using Compose Navigation, use the Wear OS version (NOT the
// androidx.navigation:navigation-compose version), that is, uncomment the line below.
implementation "androidx.wear.compose:compose-navigation:$wear_compose_version"
implementation libs.wear.compose.navigation

// Testing
testImplementation "junit:junit:$junit_version"
androidTestImplementation "androidx.test.ext:junit:$androidx_test_ext_junit_version"
androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
testImplementation libs.junit
androidTestImplementation libs.test.ext.junit
androidTestImplementation libs.test.espresso.core
androidTestImplementation libs.compose.ui.test.junit4
debugImplementation libs.compose.ui.tooling
}
Loading

0 comments on commit d16fa81

Please sign in to comment.