-
-
Notifications
You must be signed in to change notification settings - Fork 421
Android: Fix resource linking on multimodule projects #6249
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
base: main
Are you sure you want to change the base?
Changes from all commits
b431eed
1ca8462
23df257
1dd8700
33d9afc
86f97eb
4313dd4
892f393
f6d012e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -131,15 +131,24 @@ trait AndroidModule extends JavaModule { outer => | |
| * Specifies AAPT options for Android resource compilation. | ||
| */ | ||
| def androidAaptOptions: T[Seq[String]] = Task { | ||
| if (androidIsDebug()) { | ||
| Seq( | ||
| "--proguard-minimal-keep-rules", | ||
| "--debug-mode", | ||
| "--auto-add-overlay" | ||
| ) | ||
| } else { | ||
| Seq("--auto-add-overlay") | ||
| } | ||
| val debugOptions = Seq( | ||
| "--proguard-minimal-keep-rules", | ||
| "--debug-mode" | ||
| ) | ||
|
|
||
| // Add module dependencies' namespaces as extra packages | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should add a TODO here to clean up, once we rewire the submodule sources to go to the app module |
||
| // TODO: cleanup once we properly pass resources from dependencies | ||
| val extraPackages = moduleDeps.collect { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe here we need transitive modules. Also for better customisation , we can make this into a task.
|
||
| case p: AndroidModule => Seq("--extra-packages", p.androidNamespace) | ||
| }.flatten | ||
|
|
||
| Seq( | ||
| "--auto-add-overlay", | ||
| "--no-version-vectors", | ||
| "--no-proguard-location-reference", | ||
| "--non-final-ids" | ||
| ) ++ extraPackages | ||
| ++ Option.when(androidIsDebug())(debugOptions).toSeq.flatten | ||
| } | ||
|
|
||
| def androidProviderProguardConfigRules: T[Seq[String]] = Task { | ||
|
|
@@ -498,7 +507,8 @@ trait AndroidModule extends JavaModule { outer => | |
| // * it will generate R.java for the library even library has no resources declared | ||
| // * R.java will have not only resource ID from this library, but from other libraries as well. They should be stripped. | ||
| val rClassDir = androidLinkedResources().path / "generatedSources/java" | ||
| val mainRClassPath = os.walk(rClassDir) | ||
| val rSources = os.walk(rClassDir).filter(p => os.isFile(p) && p.ext == "java") | ||
| val mainRClassPath = rSources | ||
| .find(_.last == "R.java") | ||
| .get | ||
|
|
||
|
|
@@ -519,7 +529,7 @@ trait AndroidModule extends JavaModule { outer => | |
| ) | ||
| } yield PathRef(libRClassPath) | ||
|
|
||
| libClasses :+ PathRef(mainRClassPath) | ||
| libClasses ++ rSources.map(PathRef(_)) | ||
| } | ||
|
|
||
| /** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was intended to match for the
compiletask and should have failed when we defaulted BuildConfig to true in #6145 as a second source was being added, but it coincidentaly matched with theandroidCompiledRClassesNow we explicitly match for the
compiletask