Skip to content

Commit a6d2b6b

Browse files
authored
Merge pull request #2799 from blundell/fix-instru-tests
Update Gradle, AGP, Hilt
2 parents fabd71f + 89a3079 commit a6d2b6b

File tree

20 files changed

+112
-43
lines changed

20 files changed

+112
-43
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,18 @@ jobs:
7171
path: |
7272
~/.android/avd/*
7373
~/.android/adb*
74-
key: avd-cached-${{ matrix.api-level }}-${{ matrix.os }}-${{ matrix.target }}
74+
key: avd-cached-${{ matrix.api-level }}-${{ matrix.os }}-${{ matrix.target }}-${{ hashFiles('**/libs.versions.toml') }}
75+
restore-keys: |
76+
avd-cached-${{ matrix.api-level }}-${{ matrix.os }}-${{ matrix.target }}-
7577
- name: Create AVD and generate snapshot for caching
7678
if: steps.avd-cache.outputs.cache-hit != 'true'
7779
uses: reactivecircus/android-emulator-runner@v2
7880
with:
7981
api-level: ${{ matrix.api-level }}
8082
target: ${{ matrix.target }}
8183
arch: ${{ matrix.arch }}
82-
force-avd-creation: false
84+
# FORCE true here ensures if 'actions/cache' restored old avd, we wipe and start with a fresh image for the new dependency hash.
85+
force-avd-creation: true
8386
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-snapshot-load
8487
disable-animations: false
8588
script: echo "Generated AVD snapshot for caching."
@@ -92,14 +95,6 @@ jobs:
9295
arch: ${{ matrix.arch }}
9396
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-snapshot-save
9497
script: |
95-
# Uninstall existing packages to avoid INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES
96-
# when a cached AVD snapshot has old APKs signed with different keys.
97-
adb uninstall com.squareup.leakcanary || true
98-
adb uninstall com.squareup.leakcanary.test || true
99-
adb uninstall com.squareup.leakcanary.core || true
100-
adb uninstall com.squareup.leakcanary.core.test || true
101-
adb uninstall com.squareup.leakcanary.instrumentation || true
102-
adb uninstall com.squareup.leakcanary.instrumentation.test || true
10398
touch emulator.log
10499
chmod 777 emulator.log
105100
adb logcat >> emulator.log &

build.gradle.kts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ buildscript {
2222
classpath(libs.gradlePlugin.binaryCompatibility)
2323
classpath(libs.gradlePlugin.keeper)
2424
classpath(libs.gradlePlugin.sqldelight)
25-
classpath("com.google.dagger:hilt-android-gradle-plugin:2.43.2")
25+
classpath(libs.gradlePlugin.hilt)
2626
}
2727
}
2828

@@ -68,6 +68,8 @@ subprojects {
6868
"-Xlint:all",
6969
"-Xlint:-serial",
7070
"-Xlint:-deprecation",
71+
"-Xlint:-options", // Silences Java 8 obsolete warning
72+
// "-Xlint:-this-escape", // Silences Java 21+ leaking 'this' warning (Java 21+ only) (Currently we build with J17 so not needed)
7173
// espresso-core classes say they're compiled with 51.0 but contain 52.0 attributes.
7274
// warning: [classfile] MethodParameters attribute introduced in version 52.0 class files is ignored in version 51.0 class files
7375
// "-Werror"

gradle/libs.versions.toml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,27 @@
1818
compose = "1.4.3"
1919
kotlin = "1.8.21"
2020
coroutines = "1.7.3"
21-
androidXTest = "1.1.0"
22-
androidXJunit = "1.1.3"
21+
androidXTest = "1.5.0"
22+
androidXJunit = "1.1.5"
2323
workManager = "2.7.0"
2424
detekt = "1.23.8"
25+
hilt = "2.53"
2526
androidMinSdk = "14"
26-
androidCompileSdk = "34"
27+
androidCompileSdk = "35"
2728

2829
[libraries]
29-
gradlePlugin-android = { module = "com.android.tools.build:gradle", version = "8.0.0" }
30+
gradlePlugin-android = { module = "com.android.tools.build:gradle", version = "8.2.2" }
3031
gradlePlugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
3132
gradlePlugin-dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version = "1.8.10" }
3233
gradlePlugin-binaryCompatibility = { module = "org.jetbrains.kotlinx:binary-compatibility-validator", version = "0.13.1" }
3334
gradlePlugin-mavenPublish = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.25.2" }
3435
gradlePlugin-detekt = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detekt" }
3536
gradlePlugin-keeper = { module = "com.slack.keeper:keeper", version = "0.7.0" }
3637
gradlePlugin-sqldelight = { module = "app.cash.sqldelight:gradle-plugin", version = "2.0.0-alpha05" }
38+
gradlePlugin-hilt = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hilt" }
39+
40+
hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
41+
hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" }
3742

3843
coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
3944

@@ -50,13 +55,13 @@ androidX-fragment = { module = "androidx.fragment:fragment", version = "1.0.0" }
5055
androidX-multidex = { module = "androidx.multidex:multidex", version = "2.0.1" }
5156
# Exposed transitively, avoid increasing
5257
androidX-startup = { module = "androidx.startup:startup-runtime", version = "1.0.0" }
53-
androidX-test-core = { module = "androidx.test:core", version = "1.4.0" }
54-
androidX-test-monitor = { module = "androidx.test:monitor", version = "1.4.0" }
58+
androidX-test-core = { module = "androidx.test:core", version = "1.5.0" }
59+
androidX-test-monitor = { module = "androidx.test:monitor", version = "1.6.1" }
5560
androidX-test-rules = { module = "androidx.test:rules", version.ref = "androidXTest" }
5661
# Exposed transitively, avoid increasing
57-
androidX-test-runner = { module = "androidx.test:runner", version = "1.4.0" }
58-
androidX-test-orchestrator = { module = "androidx.test:orchestrator", version = "1.4.1" }
59-
androidX-test-espresso = { module = "androidx.test.espresso:espresso-core", version = "3.4.0" }
62+
androidX-test-runner = { module = "androidx.test:runner", version = "1.5.2" }
63+
androidX-test-orchestrator = { module = "androidx.test:orchestrator", version = "1.4.2" } # 1.5.0+ requires API 21+, keeping at 1.4.2 for API 16 compatibility
64+
androidX-test-espresso = { module = "androidx.test.espresso:espresso-core", version = "3.5.1" }
6065
androidX-test-junit = { module = "androidx.test.ext:junit", version.ref = "androidXJunit" }
6166
androidX-test-junitKtx = { module = "androidx.test.ext:junit-ktx", version.ref = "androidXJunit" }
6267
androidX-test-uiautomator = { module = "androidx.test.uiautomator:uiautomator", version = "2.2.0" }
@@ -70,7 +75,7 @@ clikt = { module = "com.github.ajalt:clikt", version = "2.3.0" }
7075
neo4j = { module = "org.neo4j:neo4j", version = "4.4.6" }
7176
curtains = { module = "com.squareup.curtains:curtains", version = "1.2.4" }
7277
jline = { module = "jline:jline", version = "2.14.6" }
73-
junit = { module = "junit:junit", version = "4.12" }
78+
junit = { module = "junit:junit", version = "4.13.2" }
7479
kotlinStatistics = { module = "org.nield:kotlin-statistics", version = "1.2.1" }
7580
mockito = { module = "org.mockito:mockito-core", version = "3.5.10" }
7681
mockitoKotlin = { module = "com.nhaarman.mockitokotlin2:mockito-kotlin", version = "2.2.0" }

gradle/wrapper/gradle-wrapper.jar

-15.9 KB
Binary file not shown.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

gradlew

Lines changed: 31 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

leakcanary/leakcanary-android-core/build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ fun gitSha(): String {
3838
android {
3939
resourcePrefix = "leak_canary_"
4040
compileSdk = libs.versions.androidCompileSdk.get().toInt()
41+
42+
compileOptions {
43+
sourceCompatibility = JavaVersion.VERSION_1_8
44+
targetCompatibility = JavaVersion.VERSION_1_8
45+
}
46+
4147
defaultConfig {
4248
minSdk = libs.versions.androidMinSdk.get().toInt()
4349
// Avoid DeprecatedTargetSdkVersionDialog during UI tests

leakcanary/leakcanary-android-core/src/main/java/leakcanary/internal/LeakDirectoryProvider.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ internal class LeakDirectoryProvider constructor(
8080
}
8181

8282
@TargetApi(M) fun hasStoragePermission(): Boolean {
83+
// Defensive check: @TargetApi doesn't prevent this method from being called on older APIs
84+
@Suppress("ObsoleteSdkInt")
8385
if (SDK_INT < M) {
8486
return true
8587
}

leakcanary/leakcanary-android-core/src/main/java/leakcanary/internal/RequestPermissionActivity.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ internal class RequestPermissionActivity : Activity() {
8484

8585
fun createPendingIntent(context: Context, permission: String): PendingIntent {
8686
val intent = createIntent(context, permission)
87+
// Defensive check: @TargetApi on class doesn't prevent this method from being called on older APIs
88+
@Suppress("ObsoleteSdkInt")
8789
val flags = if (Build.VERSION.SDK_INT >= 23) {
8890
FLAG_UPDATE_CURRENT or FLAG_IMMUTABLE
8991
} else {

leakcanary/leakcanary-android-process/build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ dependencies {
1414

1515
android {
1616
compileSdk = libs.versions.androidCompileSdk.get().toInt()
17+
18+
compileOptions {
19+
sourceCompatibility = JavaVersion.VERSION_1_8
20+
targetCompatibility = JavaVersion.VERSION_1_8
21+
}
22+
1723
defaultConfig {
1824
minSdk = libs.versions.androidMinSdk.get().toInt()
1925
}

0 commit comments

Comments
 (0)