-
-
Notifications
You must be signed in to change notification settings - Fork 422
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
Changes from 7 commits
b431eed
1ca8462
23df257
1dd8700
33d9afc
86f97eb
4313dd4
892f393
f6d012e
43cf293
c521dec
dd62c3e
07040a6
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 |
|---|---|---|
|
|
@@ -235,6 +235,10 @@ trait AndroidAppModule extends AndroidModule { outer => | |
| ) | ||
| } | ||
|
|
||
| override def androidAaptOptions: T[Seq[String]] = Task { | ||
| super.androidAaptOptions().filterNot(_ == "--non-final-ids") | ||
|
||
| } | ||
|
|
||
| /** | ||
| * Regex patterns of files to be excluded from packaging into the APK. | ||
| */ | ||
|
|
||
| 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 | ||
|
||
| // TODO: cleanup once we properly pass resources from dependencies | ||
| val extraPackages = moduleDeps.collect { | ||
souvlakias marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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