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

Commit

Permalink
Update dependencies and add update deps workflow (#948)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
arriolac authored Jan 8, 2024
1 parent ce42744 commit 60a9daf
Show file tree
Hide file tree
Showing 9 changed files with 215 additions and 56 deletions.
26 changes: 26 additions & 0 deletions .github/ci-gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# Copyright 2024 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

org.gradle.daemon=false
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx5120m
org.gradle.workers.max=2

kotlin.incremental=false
kotlin.compiler.execution.strategy=in-process

# Controls KotlinOptions.allWarningsAsErrors. This is used in CI and can be set in local properties.
warningsAsErrors=true
53 changes: 53 additions & 0 deletions .github/workflows/update_deps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#
# Copyright 2024 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: Update Versions / Dependencies

on:
schedule:
- cron: '9 0 1 * *'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu'
cache: gradle

- name: Update dependencies
run: ./gradlew versionCatalogUpdate
- name: Create pull request
id: cpr
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.PAT }}
commit-message: 🤖 Update Dependencies
committer: compose-devrel-github-bot <[email protected]>
author: compose-devrel-github-bot <[email protected]>
signoff: false
branch: bot-update-deps
delete-branch: true
title: '🤖 Update Dependencies'
body: Updated depedencies
reviewers: ${{ github.actor }}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class MainApplication : Application(), Configuration.Provider {
override fun getWorkManagerConfiguration(): Configuration =
Configuration.Builder()
.setMinimumLoggingLevel(if (BuildConfig.DEBUG) android.util.Log.DEBUG else android.util.Log.ERROR)
.build()
override val workManagerConfiguration: Configuration
get() = Configuration.Builder()
.setMinimumLoggingLevel(if (BuildConfig.DEBUG) android.util.Log.DEBUG else android.util.Log.ERROR)
.build()
}
9 changes: 3 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@ plugins {
alias(libs.plugins.spotless)
alias(libs.plugins.ksp) apply false
alias(libs.plugins.android.test) apply false
alias(libs.plugins.gradle.versions)
alias(libs.plugins.version.catalog.update)
}

spotless {
kotlin {
target("**/*.kt")
ktlint(libs.versions.ktlint.get()).userData(mapOf("max_line_length" to "100"))
}
}
apply("${project.rootDir}/buildscripts/toml-updater-config.gradle")
72 changes: 72 additions & 0 deletions buildscripts/init.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright 2024 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

val ktlintVersion = "0.46.1"

initscript {
val spotlessVersion = "6.10.0"

repositories {
mavenCentral()
}

dependencies {
classpath("com.diffplug.spotless:spotless-plugin-gradle:$spotlessVersion")
}
}

allprojects {
if (this == rootProject) {
return@allprojects
}
apply<com.diffplug.gradle.spotless.SpotlessPlugin>()
extensions.configure<com.diffplug.gradle.spotless.SpotlessExtension> {
kotlin {
target("**/*.kt")
targetExclude("**/build/**/*.kt")
ktlint(ktlintVersion).editorConfigOverride(
mapOf(
"ktlint_code_style" to "android",
"ij_kotlin_allow_trailing_comma" to true,
// These rules were introduced in ktlint 0.46.0 and should not be
// enabled without further discussion. They are disabled for now.
// See: https://github.com/pinterest/ktlint/releases/tag/0.46.0
"disabled_rules" to
"filename," +
"annotation,annotation-spacing," +
"argument-list-wrapping," +
"double-colon-spacing," +
"enum-entry-name-case," +
"multiline-if-else," +
"no-empty-first-line-in-method-block," +
"package-name," +
"trailing-comma," +
"spacing-around-angle-brackets," +
"spacing-between-declarations-with-annotations," +
"spacing-between-declarations-with-comments," +
"unary-op-spacing"
)
)
licenseHeaderFile(rootProject.file("spotless/copyright.kt"))
}
format("kts") {
target("**/*.kts")
targetExclude("**/build/**/*.kts")
// Look for the first line that doesn't have a block comment (assumed to be the license)
licenseHeaderFile(rootProject.file("spotless/copyright.kt"), "(^(?![\\/ ]\\*).*$)")
}
}
}
17 changes: 17 additions & 0 deletions buildscripts/toml-updater-config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,20 @@ versionCatalogUpdate {
keepUnusedPlugins.set(true)
}
}

def isNonStable = { String version ->
def regex = /^[0-9,.v-]+(-r)?$/
return !(version ==~ regex)
}

tasks.named("dependencyUpdates").configure {
resolutionStrategy {
componentSelection {
all {
if (isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)) {
reject('Release candidate')
}
}
}
}
}
78 changes: 37 additions & 41 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##
## Copyright 2022 Google LLC
## Copyright 2024 Google LLC
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
Expand All @@ -14,63 +14,64 @@
## limitations under the License.
##
[versions]
accessibilityTestFramework = "4.0.0"
activityCompose = "1.8.1"
androidGradlePlugin = "8.1.2"
benchmark = "1.1.0"
accessibilityTestFramework = "4.1.0"
activityCompose = "1.8.2"
androidGradlePlugin = "8.2.1"
benchmark = "1.2.2"
# @keep
compileSdk = "34"
composeLatest = "1.6.0-beta03"
# @keep
compose-compiler = "1.5.7"
composeBom = "2023.10.01"
compose-compiler = "1.5.3"
composeLatest = "1.6.0-beta03"
constraintLayoutCompose = "1.0.1"
coreTesting = "2.2.0"
coroutines = "1.6.4"
espresso = "3.4.0"
coroutines = "1.7.3"
espresso = "3.5.1"
glide = "1.0.0-beta01"
gradle = "7.2.0"
gradle-versions = "0.50.0"
gson = "2.9.0"
guava = "31.1-android"
hilt = "2.48"
hiltNavigationCompose = "1.0.0"
guava = "33.0.0-jre"
hilt = "2.50"
hiltNavigationCompose = "1.1.0"
junit = "4.13.2"
kotlin = "1.9.10"
kotlin = "1.9.21"
ksp = "1.9.21-1.0.15"
# @keep
ktlint = "0.40.0"
ktx = "1.7.0"
lifecycle = "2.6.0-alpha04"
lifecycle = "2.6.2"
material = "1.8.0-rc01"
material3 = "1.2.0-alpha11"
material3 = "1.2.0-beta01"
# @keep
minSdk = "23"
monitor = "1.6.0"
navigation = "2.5.3"
okhttpLogging = "4.10.0"
pagingCompose = "1.0.0-alpha19"
profileInstaller = "1.2.0"
recyclerView = "1.3.0-alpha02"
minSdk = "24"
monitor = "1.6.1"
navigation = "2.7.6"
okhttpLogging = "4.12.0"
pagingCompose = "3.3.0-alpha02"
profileInstaller = "1.3.1"
retrofit = "2.9.0"
room = "2.5.2"
runner = "1.0.1"
room = "2.6.1"
spotless = "6.23.3"
systemuicontroller = "0.32.0"
# @keep
targetSdk = "34"
testExtJunit = "1.1.5"
uiAutomator = "2.2.0"
viewModelCompose = "2.5.1"
work = "2.7.1"
systemuicontroller = "0.30.1"
ksp = "1.9.10-1.0.13"
spotless = "6.4.1"
version-catalog-update = "0.8.3"
viewModelCompose = "2.6.2"
work = "2.9.0"

[libraries]
accessibility-test-framework = { module = "com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework", version.ref = "accessibilityTestFramework" }
android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "androidGradlePlugin" }
accompanist-systemuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "systemuicontroller" }
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activityCompose" }
androidx-arch-core-testing = { module = "androidx.arch.core:core-testing", version.ref = "coreTesting" }
androidx-benchmark-macro-junit4 = { module = "androidx.benchmark:benchmark-macro-junit4", version.ref = "benchmark" }
androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "composeBom" }
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "composeLatest" }
androidx-compose-foundation-layout = { module = "androidx.compose.foundation:foundation-layout", version.ref = "composeLatest" }
androidx-compose-material = { module = "androidx.compose.material:material", version.ref = "composeLatest" }
androidx-compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "material3" }
androidx-compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "composeLatest" }
androidx-compose-runtime-livedata = { module = "androidx.compose.runtime:runtime-livedata", version.ref = "composeLatest" }
Expand All @@ -93,37 +94,32 @@ androidx-paging-compose = { module = "androidx.paging:paging-compose", version.r
androidx-profileinstaller = { module = "androidx.profileinstaller:profileinstaller", version.ref = "profileInstaller" }
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" }
androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "room" }
androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" }
androidx-test-ext-junit = { module = "androidx.test.ext:junit", version.ref = "testExtJunit" }
androidx-test-uiautomator = { module = "androidx.test.uiautomator:uiautomator", version.ref = "uiAutomator" }
androidx-work-testing = { module = "androidx.work:work-testing", version.ref = "work" }
androidx-work-runtime-ktx = { module = "androidx.work:work-runtime-ktx", version.ref = "work" }
androidx-work-testing = { module = "androidx.work:work-testing", version.ref = "work" }
glide = { module = "com.github.bumptech.glide:compose", version.ref = "glide" }
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
guava = { module = "com.google.guava:guava", version.ref = "guava" }
hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
hilt-android-compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "hilt" }
hilt-android-gradle-plugin = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hilt" }
hilt-android-testing = { module = "com.google.dagger:hilt-android-testing", version.ref = "hilt" }
hilt-navigation-compose = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "hiltNavigationCompose" }
junit = { module = "junit:junit", version.ref = "junit" }
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
kotlinx-coroutines-guava = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-guava", version.ref = "coroutines" }
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" }
material = { module = "com.google.android.material:material", version.ref = "material" }
accompanist-systemuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "systemuicontroller" }
okhttp3-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttpLogging" }
retrofit2 = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
retrofit2-converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" }

[plugins]
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" }
android-test = { id = "com.android.test", version.ref = "androidGradlePlugin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
gradle-versions = { id = "com.github.ben-manes.versions", version.ref = "gradle-versions" }
hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin"}
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
version-catalog-update = { id = "nl.littlerobots.version-catalog-update", version.ref = "version-catalog-update" }
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Oct 13 20:23:10 PDT 2020
#Wed Jan 03 11:14:53 PST 2024
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

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

import androidx.benchmark.macro.ExperimentalBaselineProfilesApi
import androidx.benchmark.macro.junit4.BaselineProfileRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.uiautomator.By
Expand All @@ -25,7 +24,6 @@ import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

@OptIn(ExperimentalBaselineProfilesApi::class)
@RunWith(AndroidJUnit4::class)
class BaselineProfileGenerator {

Expand All @@ -34,7 +32,7 @@ class BaselineProfileGenerator {

@Test
fun startPlantListPlantDetail() {
rule.collectBaselineProfile(PACKAGE_NAME) {
rule.collect(PACKAGE_NAME) {
// start the app flow
pressHome()
startActivityAndWait()
Expand Down

0 comments on commit 60a9daf

Please sign in to comment.