Commit 2e4a6ab
[Xamarin.Android.Build.Tasks] support Embedded DSOs (#2579)
Fixes: #2415
Context: #2154
Currently, in order to activate the embedded Dynamic Shared Object
(DSO) support, one has to perform the following actions manually
(see also 95ca102):
1. Add the `android:extractNativeLibs="false"` attribute to the
`<application>` element within `Properties/AndroidManifest.xml`.
2. Add the following property to the project file:
<AndroidStoreUncompressedFileExtensions>.so</AndroidStoreUncompressedFileExtensions>
3. Add an android environment file to the project with a line
containing:
__XA_DSO_IN_APK=1
Instead of requiring these three separate steps, the presence of the
`//application[@android:extractNativeLibs='false']` attribute within
`AndroidManifest.xml` should instead be used as the "feature" toggle;
when `extractNativeLibs` is false, then
`$(AndroidStoreUncompressedFileExtensions)` should be automatically
updated and the `__XA_DSO_IN_APK` environment variable should
automatically exported:
1. Append the value `.so` to
`$(AndroidStoreUncompressedFileExtensions)`.
Both of the `<Aapt/>` and `<BuildApk/>` MSBuild tasks use
this property.
2. Create a new file within `$(IntermediateOutputPath)` containing
the string `__XA_DSO_IN_APK=1`, and add this new file to
`@(AndroidEnvironment)` so that `__XA_DSO_IN_APK` is set.
The problem here is with incremental builds; if the
`_GenerateJavaStubs` target is skipped, we still need to know if
`//application/@android:extractNativeLibs` is set. To make this
work, I added a `CacheFile` property on the `<GenerateJavaStubs/>`
MSBuild task. It writes a simple XML document to
`$(IntermediateOutputPath)javastubs.cache`, such as:
<Properties>
<EmbeddedDSOsEnabled>True</EmbeddedDSOsEnabled>
</Properties>
The file will not exist at all unless the value is `True`, which will
prevent this feature from impacting build times.
I also added an MSBuild test to verify these changes are happening.
I also updated `tests/EmbeddedDSOs` to rely on the new functionality.
Finally, I updated the `_GenerateJavaStubs` target to follow the
"stamp" file convention of using
`$(_AndroidStampDirectory)_GenerateJavaStubs.stamp`.1 parent b90d3ab commit 2e4a6ab
File tree
10 files changed
+201
-13
lines changed- Documentation/guides
- src/Xamarin.Android.Build.Tasks
- Tasks
- Tests/Xamarin.Android.Build.Tests
- Utilities
- tests
- CodeGen-Binding/Xamarin.Android.McwGen-Tests/Jars
- EmbeddedDSOs/EmbeddedDSO
10 files changed
+201
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 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 | + | |
Lines changed: 22 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
71 | 76 | | |
72 | 77 | | |
73 | 78 | | |
| |||
223 | 228 | | |
224 | 229 | | |
225 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
226 | 247 | | |
227 | 248 | | |
228 | 249 | | |
| |||
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
Lines changed: 47 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
205 | 252 | | |
206 | 253 | | |
207 | 254 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
644 | 644 | | |
645 | 645 | | |
646 | 646 | | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
647 | 661 | | |
648 | 662 | | |
649 | 663 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
| |||
Lines changed: 39 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| |||
2284 | 2285 | | |
2285 | 2286 | | |
2286 | 2287 | | |
2287 | | - | |
| 2288 | + | |
2288 | 2289 | | |
2289 | 2290 | | |
2290 | 2291 | | |
| |||
2308 | 2309 | | |
2309 | 2310 | | |
2310 | 2311 | | |
2311 | | - | |
| 2312 | + | |
| 2313 | + | |
2312 | 2314 | | |
2313 | 2315 | | |
2314 | 2316 | | |
| |||
2317 | 2319 | | |
2318 | 2320 | | |
2319 | 2321 | | |
2320 | | - | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
| 2338 | + | |
| 2339 | + | |
| 2340 | + | |
| 2341 | + | |
| 2342 | + | |
| 2343 | + | |
| 2344 | + | |
| 2345 | + | |
2321 | 2346 | | |
2322 | | - | |
| 2347 | + | |
| 2348 | + | |
2323 | 2349 | | |
2324 | 2350 | | |
2325 | 2351 | | |
2326 | | - | |
| 2352 | + | |
| 2353 | + | |
| 2354 | + | |
| 2355 | + | |
| 2356 | + | |
| 2357 | + | |
| 2358 | + | |
| 2359 | + | |
| 2360 | + | |
2327 | 2361 | | |
2328 | 2362 | | |
2329 | 2363 | | |
| |||
3195 | 3229 | | |
3196 | 3230 | | |
3197 | 3231 | | |
3198 | | - | |
3199 | 3232 | | |
3200 | 3233 | | |
3201 | 3234 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | 21 | | |
27 | 22 | | |
28 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
0 commit comments