Skip to content
This repository was archived by the owner on Aug 2, 2024. It is now read-only.

Commit 60a9daf

Browse files
authored
Update dependencies and add update deps workflow (#948)
* Add workflow to update dependencies. Change-Id: Ic667c05d37eee5738bc24b2a18b2182093abb5c0 * Update dependencies and add update deps workflow. Change-Id: Ia037b710c933db39aca71db19d5bcfdf476bf0e9 * Address PR comments and remove unused dependencies. Change-Id: I4c327c615af09020f07cc9efcae98e0195c820e7
1 parent ce42744 commit 60a9daf

File tree

9 files changed

+215
-56
lines changed

9 files changed

+215
-56
lines changed

.github/ci-gradle.properties

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#
2+
# Copyright 2024 The Android Open Source Project
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
org.gradle.daemon=false
18+
org.gradle.parallel=true
19+
org.gradle.jvmargs=-Xmx5120m
20+
org.gradle.workers.max=2
21+
22+
kotlin.incremental=false
23+
kotlin.compiler.execution.strategy=in-process
24+
25+
# Controls KotlinOptions.allWarningsAsErrors. This is used in CI and can be set in local properties.
26+
warningsAsErrors=true

.github/workflows/update_deps.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#
2+
# Copyright 2024 The Android Open Source Project
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
name: Update Versions / Dependencies
18+
19+
on:
20+
schedule:
21+
- cron: '9 0 1 * *'
22+
workflow_dispatch:
23+
24+
jobs:
25+
build:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v3
29+
- name: Copy CI gradle.properties
30+
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
31+
- name: set up JDK 17
32+
uses: actions/setup-java@v3
33+
with:
34+
java-version: 17
35+
distribution: 'zulu'
36+
cache: gradle
37+
38+
- name: Update dependencies
39+
run: ./gradlew versionCatalogUpdate
40+
- name: Create pull request
41+
id: cpr
42+
uses: peter-evans/create-pull-request@v4
43+
with:
44+
token: ${{ secrets.PAT }}
45+
commit-message: 🤖 Update Dependencies
46+
committer: compose-devrel-github-bot <[email protected]>
47+
author: compose-devrel-github-bot <[email protected]>
48+
signoff: false
49+
branch: bot-update-deps
50+
delete-branch: true
51+
title: '🤖 Update Dependencies'
52+
body: Updated depedencies
53+
reviewers: ${{ github.actor }}

app/src/main/java/com/google/samples/apps/sunflower/MainApplication.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import dagger.hilt.android.HiltAndroidApp
2222

2323
@HiltAndroidApp
2424
class MainApplication : Application(), Configuration.Provider {
25-
override fun getWorkManagerConfiguration(): Configuration =
26-
Configuration.Builder()
27-
.setMinimumLoggingLevel(if (BuildConfig.DEBUG) android.util.Log.DEBUG else android.util.Log.ERROR)
28-
.build()
25+
override val workManagerConfiguration: Configuration
26+
get() = Configuration.Builder()
27+
.setMinimumLoggingLevel(if (BuildConfig.DEBUG) android.util.Log.DEBUG else android.util.Log.ERROR)
28+
.build()
2929
}

build.gradle.kts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,8 @@ plugins {
2828
alias(libs.plugins.spotless)
2929
alias(libs.plugins.ksp) apply false
3030
alias(libs.plugins.android.test) apply false
31+
alias(libs.plugins.gradle.versions)
32+
alias(libs.plugins.version.catalog.update)
3133
}
3234

33-
spotless {
34-
kotlin {
35-
target("**/*.kt")
36-
ktlint(libs.versions.ktlint.get()).userData(mapOf("max_line_length" to "100"))
37-
}
38-
}
35+
apply("${project.rootDir}/buildscripts/toml-updater-config.gradle")

buildscripts/init.gradle.kts

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* Copyright 2024 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
val ktlintVersion = "0.46.1"
18+
19+
initscript {
20+
val spotlessVersion = "6.10.0"
21+
22+
repositories {
23+
mavenCentral()
24+
}
25+
26+
dependencies {
27+
classpath("com.diffplug.spotless:spotless-plugin-gradle:$spotlessVersion")
28+
}
29+
}
30+
31+
allprojects {
32+
if (this == rootProject) {
33+
return@allprojects
34+
}
35+
apply<com.diffplug.gradle.spotless.SpotlessPlugin>()
36+
extensions.configure<com.diffplug.gradle.spotless.SpotlessExtension> {
37+
kotlin {
38+
target("**/*.kt")
39+
targetExclude("**/build/**/*.kt")
40+
ktlint(ktlintVersion).editorConfigOverride(
41+
mapOf(
42+
"ktlint_code_style" to "android",
43+
"ij_kotlin_allow_trailing_comma" to true,
44+
// These rules were introduced in ktlint 0.46.0 and should not be
45+
// enabled without further discussion. They are disabled for now.
46+
// See: https://github.com/pinterest/ktlint/releases/tag/0.46.0
47+
"disabled_rules" to
48+
"filename," +
49+
"annotation,annotation-spacing," +
50+
"argument-list-wrapping," +
51+
"double-colon-spacing," +
52+
"enum-entry-name-case," +
53+
"multiline-if-else," +
54+
"no-empty-first-line-in-method-block," +
55+
"package-name," +
56+
"trailing-comma," +
57+
"spacing-around-angle-brackets," +
58+
"spacing-between-declarations-with-annotations," +
59+
"spacing-between-declarations-with-comments," +
60+
"unary-op-spacing"
61+
)
62+
)
63+
licenseHeaderFile(rootProject.file("spotless/copyright.kt"))
64+
}
65+
format("kts") {
66+
target("**/*.kts")
67+
targetExclude("**/build/**/*.kts")
68+
// Look for the first line that doesn't have a block comment (assumed to be the license)
69+
licenseHeaderFile(rootProject.file("spotless/copyright.kt"), "(^(?![\\/ ]\\*).*$)")
70+
}
71+
}
72+
}

buildscripts/toml-updater-config.gradle

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,20 @@ versionCatalogUpdate {
2626
keepUnusedPlugins.set(true)
2727
}
2828
}
29+
30+
def isNonStable = { String version ->
31+
def regex = /^[0-9,.v-]+(-r)?$/
32+
return !(version ==~ regex)
33+
}
34+
35+
tasks.named("dependencyUpdates").configure {
36+
resolutionStrategy {
37+
componentSelection {
38+
all {
39+
if (isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)) {
40+
reject('Release candidate')
41+
}
42+
}
43+
}
44+
}
45+
}

gradle/libs.versions.toml

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
##
2-
## Copyright 2022 Google LLC
2+
## Copyright 2024 Google LLC
33
##
44
## Licensed under the Apache License, Version 2.0 (the "License");
55
## you may not use this file except in compliance with the License.
@@ -14,63 +14,64 @@
1414
## limitations under the License.
1515
##
1616
[versions]
17-
accessibilityTestFramework = "4.0.0"
18-
activityCompose = "1.8.1"
19-
androidGradlePlugin = "8.1.2"
20-
benchmark = "1.1.0"
17+
accessibilityTestFramework = "4.1.0"
18+
activityCompose = "1.8.2"
19+
androidGradlePlugin = "8.2.1"
20+
benchmark = "1.2.2"
2121
# @keep
2222
compileSdk = "34"
23-
composeLatest = "1.6.0-beta03"
23+
# @keep
24+
compose-compiler = "1.5.7"
2425
composeBom = "2023.10.01"
25-
compose-compiler = "1.5.3"
26+
composeLatest = "1.6.0-beta03"
2627
constraintLayoutCompose = "1.0.1"
2728
coreTesting = "2.2.0"
28-
coroutines = "1.6.4"
29-
espresso = "3.4.0"
29+
coroutines = "1.7.3"
30+
espresso = "3.5.1"
3031
glide = "1.0.0-beta01"
3132
gradle = "7.2.0"
33+
gradle-versions = "0.50.0"
3234
gson = "2.9.0"
33-
guava = "31.1-android"
34-
hilt = "2.48"
35-
hiltNavigationCompose = "1.0.0"
35+
guava = "33.0.0-jre"
36+
hilt = "2.50"
37+
hiltNavigationCompose = "1.1.0"
3638
junit = "4.13.2"
37-
kotlin = "1.9.10"
39+
kotlin = "1.9.21"
40+
ksp = "1.9.21-1.0.15"
41+
# @keep
3842
ktlint = "0.40.0"
3943
ktx = "1.7.0"
40-
lifecycle = "2.6.0-alpha04"
44+
lifecycle = "2.6.2"
4145
material = "1.8.0-rc01"
42-
material3 = "1.2.0-alpha11"
46+
material3 = "1.2.0-beta01"
4347
# @keep
44-
minSdk = "23"
45-
monitor = "1.6.0"
46-
navigation = "2.5.3"
47-
okhttpLogging = "4.10.0"
48-
pagingCompose = "1.0.0-alpha19"
49-
profileInstaller = "1.2.0"
50-
recyclerView = "1.3.0-alpha02"
48+
minSdk = "24"
49+
monitor = "1.6.1"
50+
navigation = "2.7.6"
51+
okhttpLogging = "4.12.0"
52+
pagingCompose = "3.3.0-alpha02"
53+
profileInstaller = "1.3.1"
5154
retrofit = "2.9.0"
52-
room = "2.5.2"
53-
runner = "1.0.1"
55+
room = "2.6.1"
56+
spotless = "6.23.3"
57+
systemuicontroller = "0.32.0"
5458
# @keep
5559
targetSdk = "34"
5660
testExtJunit = "1.1.5"
5761
uiAutomator = "2.2.0"
58-
viewModelCompose = "2.5.1"
59-
work = "2.7.1"
60-
systemuicontroller = "0.30.1"
61-
ksp = "1.9.10-1.0.13"
62-
spotless = "6.4.1"
62+
version-catalog-update = "0.8.3"
63+
viewModelCompose = "2.6.2"
64+
work = "2.9.0"
6365

6466
[libraries]
6567
accessibility-test-framework = { module = "com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework", version.ref = "accessibilityTestFramework" }
66-
android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "androidGradlePlugin" }
68+
accompanist-systemuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "systemuicontroller" }
6769
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activityCompose" }
6870
androidx-arch-core-testing = { module = "androidx.arch.core:core-testing", version.ref = "coreTesting" }
6971
androidx-benchmark-macro-junit4 = { module = "androidx.benchmark:benchmark-macro-junit4", version.ref = "benchmark" }
7072
androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "composeBom" }
7173
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "composeLatest" }
7274
androidx-compose-foundation-layout = { module = "androidx.compose.foundation:foundation-layout", version.ref = "composeLatest" }
73-
androidx-compose-material = { module = "androidx.compose.material:material", version.ref = "composeLatest" }
7475
androidx-compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "material3" }
7576
androidx-compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "composeLatest" }
7677
androidx-compose-runtime-livedata = { module = "androidx.compose.runtime:runtime-livedata", version.ref = "composeLatest" }
@@ -93,37 +94,32 @@ androidx-paging-compose = { module = "androidx.paging:paging-compose", version.r
9394
androidx-profileinstaller = { module = "androidx.profileinstaller:profileinstaller", version.ref = "profileInstaller" }
9495
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" }
9596
androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "room" }
96-
androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" }
9797
androidx-test-ext-junit = { module = "androidx.test.ext:junit", version.ref = "testExtJunit" }
9898
androidx-test-uiautomator = { module = "androidx.test.uiautomator:uiautomator", version.ref = "uiAutomator" }
99-
androidx-work-testing = { module = "androidx.work:work-testing", version.ref = "work" }
10099
androidx-work-runtime-ktx = { module = "androidx.work:work-runtime-ktx", version.ref = "work" }
100+
androidx-work-testing = { module = "androidx.work:work-testing", version.ref = "work" }
101101
glide = { module = "com.github.bumptech.glide:compose", version.ref = "glide" }
102102
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
103103
guava = { module = "com.google.guava:guava", version.ref = "guava" }
104104
hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
105105
hilt-android-compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "hilt" }
106-
hilt-android-gradle-plugin = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hilt" }
107106
hilt-android-testing = { module = "com.google.dagger:hilt-android-testing", version.ref = "hilt" }
108107
hilt-navigation-compose = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "hiltNavigationCompose" }
109108
junit = { module = "junit:junit", version.ref = "junit" }
110-
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
111109
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" }
112110
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
113-
kotlinx-coroutines-guava = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-guava", version.ref = "coroutines" }
114111
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" }
115112
material = { module = "com.google.android.material:material", version.ref = "material" }
116-
accompanist-systemuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "systemuicontroller" }
117113
okhttp3-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttpLogging" }
118114
retrofit2 = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
119115
retrofit2-converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" }
120116

121117
[plugins]
122118
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
123-
android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" }
124119
android-test = { id = "com.android.test", version.ref = "androidGradlePlugin" }
125-
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
120+
gradle-versions = { id = "com.github.ben-manes.versions", version.ref = "gradle-versions" }
126121
hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
122+
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
123+
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
127124
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
128-
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin"}
129-
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
125+
version-catalog-update = { id = "nl.littlerobots.version-catalog-update", version.ref = "version-catalog-update" }
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Tue Oct 13 20:23:10 PDT 2020
1+
#Wed Jan 03 11:14:53 PST 2024
22
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
43
distributionPath=wrapper/dists
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

macrobenchmark/src/main/java/com/google/samples/apps/sunflower/macrobenchmark/BaselineProfileGenerator.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.google.samples.apps.sunflower.macrobenchmark
1818

19-
import androidx.benchmark.macro.ExperimentalBaselineProfilesApi
2019
import androidx.benchmark.macro.junit4.BaselineProfileRule
2120
import androidx.test.ext.junit.runners.AndroidJUnit4
2221
import androidx.test.uiautomator.By
@@ -25,7 +24,6 @@ import org.junit.Rule
2524
import org.junit.Test
2625
import org.junit.runner.RunWith
2726

28-
@OptIn(ExperimentalBaselineProfilesApi::class)
2927
@RunWith(AndroidJUnit4::class)
3028
class BaselineProfileGenerator {
3129

@@ -34,7 +32,7 @@ class BaselineProfileGenerator {
3432

3533
@Test
3634
fun startPlantListPlantDetail() {
37-
rule.collectBaselineProfile(PACKAGE_NAME) {
35+
rule.collect(PACKAGE_NAME) {
3836
// start the app flow
3937
pressHome()
4038
startActivityAndWait()

0 commit comments

Comments
 (0)