Status Update
Comments
uc...@google.com <uc...@google.com>
ga...@google.com <ga...@google.com>
sp...@google.com <sp...@google.com> #2
As I understand it, we need to migrate namespace definitions both from AndroidManifest.xml
and from implicit definitions from applicationId
/ testApplicationId
? Is that right? So an 8.0 project would have a
namespace <n>
testNamespace <tn>
where <n> is taken from AndroidManifest.xml
package
definitions if present, and applicationId
if not, and <tn>
is testApplicationId
if present and <n>.test
if not?
pa...@gmail.com <pa...@gmail.com> #3
Sorry for the confusion. AGP would change how it computes the namespace for the androidTest variant. All the Upgrade assistant would need to do is update the source code for the import of the R
class.
da...@gmail.com <da...@gmail.com> #4
OK! And, I think, this should happen at the same time as the namespace
declaration is migrated from AndroidManifest.xml
?
ts...@vewd.com <ts...@vewd.com> #5
It's unrelated, but it is possible that we move 8.0 to also only declare the namespace into the DSL. I would make it a separate refactoring because they are not tied at all.
pa...@gmail.com <pa...@gmail.com> #6
I would consider first adding the right new value to models (as a new property) and then, to avoid Studio interpreting manifests and build configurations, just update to whatever the synced value of this new property is.
sp...@google.com <sp...@google.com> #7
Updated version of this in #16 below
Currently, AUA removes the package
attribute from the main manifest and instead specifies that value via the namespace
DSL.
In addition to that, AUA should:
(1) Check for apackage
attribute in the (possibly non-existent) androidTestAndroidManifest.xml
. If there's a value there, it should be removed from that manifest, and if it's not equal tonamespace + ".test"
, it should be specified via thetestNamespace
DSL.Ifnamespace
==testNamespace
, this is problematic because the androidTest and regularR
classes will have the same namespace. Not sure what the best behavior is here? Maybe an error explaining that the user should first reset the androidTest AndroidManifest'spackage
attribute and change the androidTest source code package accordingly?
- (2)
Compare the newtestNamespace
with the oldAndroidProject.androidTestNamespace
from the model. If they are different, search the androidTest source code for references to anR
class namespaced withAndroidProejct.androidTestNamespace
, and change the namespace totestNamespace
.
Description
DESCRIBE THE ISSUE IN DETAIL:
It is possible to put
lint.xml
s in therootProject
and in every module individually. These will be considered together to set up configuration for each module. In the attach project the structure is:app
lint.xml
missing, will use../lint.xml
lib
lint.xml
exists, but empty (will be modified by step 6)lint.xml
exists, and suppresses the clear unused resources by pattern.STEPS TO REPRODUCE:
gradlew lint
:lib:lintDebug
telling us there's an unused resource called "unused" inlib/build/reports/lint-results-debug.html
gradlew lint
lib/lint.xml
and uncomment<ignore>
gradlew lint
Actual: Observe nothing was executed, everything up-to-date.
Expected: lint analysis re-executes and updates the HTML report with the findings based on the newly changed config file.
Bonus steps to prove that the uncommenting should have an effect:
gradlew clean lint --no-build-cache
Workaround
polyfill missing setup