Commit 5ee9bab
authored
[brownfield] Fix reading updates app.manifest and meta-data tags (expo#45655)
# Why
`expo-updates` would fail to read app.manifest and meta-data tags when
consuming it as a brownfield AAR, causing update to not start up
properly on android
# How
Extended `expo-brownfield`'s gradle plugin (`ExpoBrownfieldSetupPlugin`)
to forward the host `:app` module's build-time outputs into the
published brownfield AAR's release variant. Two pieces are forwarded:
1. **`:app:mergeReleaseAssets` output** is copied into a generated
source dir on the `:brownfield` library and registered as a
release-variant asset source. Forwarding the *merged* assets output
(rather than a specific generator task) is deliberate: it picks up
everything AGP would bundle into the host APK's `assets/` — the RN JS
bundle, expo-updates' `app.manifest`, expo-constants' `app.config`, and
any future generated asset emitted by a host-side gradle plugin. The old
`setupBundleDependencyForRelease` and the standalone
`generated/assets/react/release` source dir are now subsumed by this.
2. **Every `<application>` `<meta-data>` entry** from
`:app/src/main/AndroidManifest.xml` is forwarded into a generated
release-variant manifest on the `:brownfield` library, which AGP merges
into the consumer's manifest at AAR-consumption time. This covers
expo-updates, expo-notifications, expo-dev-launcher, and any other
config plugin that injects runtime configuration into the host manifest.
The forwarder also resolves `@string/...` references against
`:app/src/main/res/values/strings.xml` (inlining e.g.
`expo_runtime_version` → `"1.0.0"`) so the AAR doesn't need to also
forward `strings.xml`, and preserves `android:resource="..."` refs
alongside `android:value="..."`.
# Test Plan
End-to-end on Android:
1. **Publish the brownfield AAR to Maven Local**
```bash
cd apps/minimal-tester
npx expo-brownfield build:android --repository MavenLocal --release
```
2. **Verify the AAR carries the forwarded artifacts**
```bash
AAR=~/.m2/repository/com/community/minimaltester/brownfield/1.0.0/brownfield-1.0.0.aar
unzip -l "$AAR" | grep -E 'assets/|AndroidManifest'
unzip -p "$AAR" AndroidManifest.xml
unzip -p "$AAR" assets/app.manifest
unzip -p "$AAR" assets/app.config
```
3. **Run the brownfield consumer against the published AAR**
```bash
cd apps/brownfield-tester/isolated/android
./gradlew assembleRelease
```
4. **Confirm the consumer's merged manifest picked up the forwarded
meta-data**
```bash
grep -A1 expo.modules.updates \
apps/brownfield-tester/isolated/android/app/build/intermediates/merged_manifests/release/processReleaseManifest/AndroidManifest.xml
```
# Checklist
<!--
Please check the appropriate items below if they apply to your diff.
-->
- [ ] I added a `changelog.md` entry and rebuilt the package sources
according to [this short
guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)1 parent dc733c9 commit 5ee9bab
3 files changed
Lines changed: 174 additions & 11 deletions
File tree
- packages/expo-brownfield
- gradle-plugins/brownfield/src/main/kotlin/expo/modules/plugin
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
Lines changed: 67 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
| 124 | + | |
124 | 125 | | |
125 | | - | |
| 126 | + | |
126 | 127 | | |
127 | | - | |
128 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
129 | 142 | | |
130 | | - | |
| 143 | + | |
131 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
132 | 184 | | |
133 | | - | |
| 185 | + | |
| 186 | + | |
134 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
135 | 191 | | |
136 | 192 | | |
137 | 193 | | |
| |||
266 | 322 | | |
267 | 323 | | |
268 | 324 | | |
269 | | - | |
| 325 | + | |
270 | 326 | | |
271 | 327 | | |
272 | 328 | | |
| |||
275 | 331 | | |
276 | 332 | | |
277 | 333 | | |
278 | | - | |
| 334 | + | |
279 | 335 | | |
280 | 336 | | |
281 | 337 | | |
| |||
284 | 340 | | |
285 | 341 | | |
286 | 342 | | |
287 | | - | |
| 343 | + | |
288 | 344 | | |
289 | 345 | | |
290 | 346 | | |
Lines changed: 105 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
| 5 | + | |
| 6 | + | |
3 | 7 | | |
| 8 | + | |
4 | 9 | | |
5 | 10 | | |
6 | 11 | | |
| |||
14 | 19 | | |
15 | 20 | | |
16 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
0 commit comments