Commit d653245
authored
[Xamarin.Android.Build.Tasks] AndroidPackageFormat=aab incr build (#5760)
Fixes: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1288593
This is a weird bug which I cannot reproduce locally. However,
reading the code this code path is possible:
When trying to do incremental builds when using
`$(AndroidPackageFormat)`=aab, we get the following error:
[BT : 1.4.0] error : Module 'base' is missing mandatory file 'manifest/AndroidManifest.xml'.
The problem is that `base.zip` doesn't have *any*
`AndroidManifest.xml` in it! But why?
What appears to happen is:
1. During "initial build", `packaged_resources` is created, and
contains `AndroidManifest.xml`. `base.zip` is created based on
the contents of `packaged_resources`, renaming
`AndroidManifest.xml` to `manifest/AndroidManifest.xml`, so that
`base.zip` has the expected folder structure for `aab` files.
(This "copy and rename" is done by `<FixupArchive/>`.)
Both `packaged_resources` and `base.zip` have the same timestamp.
2. On a subsequent incremental build, neither `packaged_resources`
nor `base.zip` is changed (because they didn't need to, e.g. no
Android Resources were added), and the `_BuildApkEmbed` target is
executed.
3. The `_BuildApkEmbed` target runs the `<BuildApk/>` task, which
"cleans up removed files" within `base.zip`. Because there is no
corresponding file "on disk" for `manifest/AndroidManifest.xml`
within `base.zip`, the `manifest/AndroidManifest.xml` file is
*removed* from `base.zip`.
4. `_BuildApkEmbed` later calls `<BuildAppBundle/>`, which calls
`bundletool.jar`, and fails with the above error message:
[BT : 1.4.0] error : Module 'base' is missing mandatory file 'manifest/AndroidManifest.xml'.
The fix is to update the `<BuildApk/>` task to *never remove* files
named `AndroidManifest.xml`. It is a protected file and should
always exist.1 parent 0192669 commit d653245
File tree
2 files changed
+11
-2
lines changed- src/Xamarin.Android.Build.Tasks/Tasks
2 files changed
+11
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
| 162 | + | |
162 | 163 | | |
| 164 | + | |
163 | 165 | | |
164 | 166 | | |
165 | 167 | | |
| |||
266 | 268 | | |
267 | 269 | | |
268 | 270 | | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
269 | 274 | | |
270 | 275 | | |
271 | 276 | | |
| |||
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | | - | |
| 36 | + | |
| 37 | + | |
36 | 38 | | |
| 39 | + | |
37 | 40 | | |
| 41 | + | |
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
| |||
0 commit comments