Skip to content

Commit 8e048a7

Browse files
authored
244: Fix GMD recordMode not working as expected (#248)
* 246: Upgrade to AGP 8.8 and Gradle 8.10.2 * 244: Fix #244 GMD recordMode not working as expected Update ManifestHelper to use alternate version of getApplicationInfo * Fix "Unresolved reference: serviceOf" * Fix "Inconsistent JVM-target compatibility detected for tasks 'compileJava' (21) and 'compileKotlin' (17)."
1 parent 38c032a commit 8e048a7

File tree

13 files changed

+24
-21
lines changed

13 files changed

+24
-21
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Testify Change Log
22

3-
## Unreleased
3+
## 3.2.1
44

5+
- Fix #244 "GMD recordMode not working as expected"
6+
- https://github.com/ndtp/android-testify/pull/248 - Update ManifestHelper to use alternate version of getApplicationInfo
57
- Respect Gradle console mode. See https://docs.gradle.org/current/userguide/command_line_interface.html#sec:command_line_customizing_log_format for more information.
68

79
## 3.2.0

Ext/Accessibility/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ For more information about _Accessibility Checking_, please see https://develope
1818

1919
```groovy
2020
plugins {
21-
id("dev.testify") version "3.2.0" apply false
21+
id("dev.testify") version "3.2.1" apply false
2222
}
2323
```
2424

Ext/Compose/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Easily create screenshot tests for `@Composable` functions.
1212

1313
```groovy
1414
plugins {
15-
id("dev.testify") version "3.2.0" apply false
15+
id("dev.testify") version "3.2.1" apply false
1616
}
1717
```
1818

Ext/Fullscreen/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ You can set a comparison tolerance using [ScreenshotRule.setExactness](../../Lib
2020

2121
```groovy
2222
plugins {
23-
id("dev.testify") version "3.2.0" apply false
23+
id("dev.testify") version "3.2.1" apply false
2424
}
2525
```
2626

Library/src/main/java/dev/testify/internal/helpers/ManifestHelpers.kt

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
*/
2424
package dev.testify.internal.helpers
2525

26-
import android.annotation.SuppressLint
2726
import android.content.Context
2827
import android.content.pm.PackageManager
2928
import android.os.Bundle
@@ -72,13 +71,8 @@ sealed class ManifestPlaceholder(val key: String) {
7271
* @return The [Bundle] of meta data, or null if it does not exist.
7372
*/
7473
@ExcludeFromJacocoGeneratedReport
75-
@SuppressLint("NewApi")
7674
internal fun getMetaDataBundle(context: Context): Bundle? {
77-
val applicationInfo = if (buildVersionSdkInt() >= android.os.Build.VERSION_CODES.TIRAMISU) {
78-
context.packageManager?.getApplicationInfo(context.packageName, PackageManager.ApplicationInfoFlags.of(0))
79-
} else {
80-
context.packageManager?.getApplicationInfo(context.packageName, PackageManager.GET_META_DATA)
81-
}
75+
val applicationInfo = context.packageManager?.getApplicationInfo(context.packageName, PackageManager.GET_META_DATA)
8276
return applicationInfo?.metaData
8377
}
8478

@@ -93,8 +87,8 @@ internal fun getMetaDataBundle(context: Context): Bundle? {
9387
@ExcludeFromJacocoGeneratedReport
9488
fun ManifestPlaceholder.getMetaDataValue(): String? {
9589
val metaData = getMetaDataBundle(InstrumentationRegistry.getInstrumentation().context)
96-
return if (metaData?.containsKey(this.key) == true)
97-
metaData.getString(this.key)
98-
else
99-
null
90+
return when {
91+
metaData?.containsKey(this.key) == true -> metaData.getString(this.key)
92+
else -> null
93+
}
10094
}

Plugins/Gradle/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ To set a dependency reference to the Testify plugin:
1414

1515
```groovy
1616
plugins {
17-
id("dev.testify") version "3.2.0" apply false
17+
id("dev.testify") version "3.2.1" apply false
1818
}
1919
```
2020

Plugins/Gradle/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ tasks.withType(KotlinJvmCompile).configureEach {
7575
}
7676
}
7777

78+
java {
79+
targetCompatibility = JavaVersion.VERSION_17
80+
}
81+
7882
jar {
7983
manifest {
8084
attributes "Implementation-Title": "Testify"

Plugins/Gradle/src/main/kotlin/dev/testify/TestifyPlugin.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import dev.testify.tasks.utility.VersionTask
5151
import org.gradle.api.Action
5252
import org.gradle.api.Plugin
5353
import org.gradle.api.Project
54-
import org.gradle.configurationcache.extensions.serviceOf
54+
import org.gradle.internal.extensions.core.serviceOf
5555
import org.gradle.internal.logging.text.StyledTextOutput
5656
import org.gradle.internal.logging.text.StyledTextOutputFactory
5757

@@ -93,10 +93,12 @@ class TestifyPlugin : Plugin<Project> {
9393
}
9494
val module = settings.moduleName
9595
val isRecordMode = settings.isRecordMode.toString()
96+
val parallelThreads = settings.parallelThreads.toString()
9697
android.defaultConfig {
9798
it.resValue("string", "testifyDestination", destination)
9899
it.resValue("string", "testifyModule", module)
99100
it.resValue("string", "isRecordMode", isRecordMode)
101+
it.resValue("string", "parallelThreads", parallelThreads)
100102
}
101103
}
102104

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Testify plugin:
6767

6868
```groovy
6969
plugins {
70-
id("dev.testify") version "3.2.0" apply false
70+
id("dev.testify") version "3.2.1" apply false
7171
}
7272
```
7373

Samples/Gmd/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ android {
6464
testify {
6565
useTestStorage true
6666
autoImplementLibrary false
67+
recordMode true
6768
}
6869

6970
dependencies {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ android.suppressUnsupportedCompileSdk=34
55
android.nonTransitiveRClass=false
66
android.nonFinalResIds=false
77
android.injected.androidTest.leaveApksInstalledAfterRun=true
8-
testify_version=3.2.0
8+
testify_version=3.2.1

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)