Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Resources$NotFoundException when accessing app module resource from dynamic feature module #1367

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,19 @@ class PaparazziPluginTest {
assertThat(result.task(":dynamic_feature:preparePaparazziDebugResources")).isNotNull()
assertThat(result.task(":dynamic_feature:testDebugUnitTest")).isNotNull()

val resourcesFile = File(fixtureRoot, "dynamic_feature/build/intermediates/paparazzi/debug/resources.json")
assertThat(resourcesFile.exists()).isTrue()

val config = resourcesFile.loadConfig()
assertThat(config.resourcePackageNames).containsExactly(
"app.cash.paparazzi.plugin.dynamic.feature.feature",
"app.cash.paparazzi.plugin.dynamic.feature.app",
"com.example.mylibrary"
)
assertThat(config.moduleResourceDirs).containsExactly(
"../app/build/intermediates/packaged_res/debug/packageDebugResources"
)

val snapshotsDir = File(fixtureRoot, "dynamic_feature/build/reports/paparazzi/debug/images")
val snapshots = snapshotsDir.listFiles()
assertThat(snapshots!!).hasLength(1)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'app.cash.paparazzi'
}

android {
Expand All @@ -15,3 +17,9 @@ android {

dynamicFeatures = [':dynamic_feature']
}

dependencies {
implementation files('libs/external.aar')
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlike library module, application module does not generate symbol_list_with_package_name/[variant]/package-aware-r.txt when there is no dependency. So I have to add one dependency in the test.

In reality, application module will always have dependencies, so there is no issue about that. We do not have to check if symbol_list_with_package_name/[variant]/package-aware-r.txt exists

apply from: '../../guava-fix.gradle'
Binary file not shown.