Commit 0778165
[api-merge] Normalize paths for comparisons (#1278)
The [macOS+xbuild build][0] is [broken][1]:
obj/Debug/android-10/mcw/Android.Content.ContentProvider.cs(282,84): error CS0234: The type or namespace name 'Collections' does not exist in the namespace 'Android.System' (are you missing an assembly reference?)
...and 1271 other similar errors...
[0]: https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android/855/
[1]: https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android/855/consoleText
The apparent cause is 7d705bf, which updated the build process to
generate `api.xml` files from `android-*.jar` at build time, instead
of requiring pre-generated paths within `src/Mono.Android/Profiles`,
as the `api-merge.exe` invocation was altered.
The *actual* cause is a latent bug in `api-merge.exe`: when using
`api-merge FILES --last-description=FILE`, `FILE` is incorrectly
compared with the list of `FILES`. When building with `xbuild`,
the `@(_AndroidProfile)` item group contains *full path names*, while
the `--last-description` option is a relative path:
Executing: mono ../../bin/BuildDebug/api-merge.exe -o "obj/Debug/android-10/mcw/api.xml" \
-s '../../bin/BuildDebug/api/api-*.xml.in' \
…/xamarin-android/bin/BuildDebug/api/api-10.xml.in \
...
--last-description=../../bin/BuildDebug/api/api-10.xml.in
Because `api-merge` didn't normalize the path names, it attempted to
compare `…/xamarin-android/bin/BuildDebug/api/api-10.xml.in` to
`../../bin/BuildDebug/api/api-10.xml.in`, which *always failed*.
Consequently, the resulting `obj/Debug/android-10/mcw/api.xml` file
contained *all* API levels, including the `android.system` package
(introduced in API-21), while not containing the namespace renaming
logic to map `android.system` to `Android.Systems`.
The result is that e.g.
obj/Debug/android-10/mcw/Android.Content.ContentProvider.cs`
contained "innocuous" identifiers such as
`System.Collections.Generic.IList<Android.Content.ContentProviderOperation>`
which were being incorrectly resolved to
`Android.System.Collections.Generic.IList<Android.Content.ContentProviderOperation>`,
which doesn't exist.
Fix `api-merge` so that it compares *full paths* to
`api-merge --last-description=FILE`, allowing the `api-merge` command
to properly stop merging APIs once it's hit (in this case)
`api-10.xml.in`.1 parent d46abe8 commit 0778165
1 file changed
+10
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
80 | 88 | | |
81 | 89 | | |
82 | 90 | | |
| |||
0 commit comments