Commit 568d24a
committed
[generator] Allow multiple
Context: dotnet/android#4356 (comment)
A "funny" thing was found with API-R: the Android SDK
`platforms/android-R/data/api-versions.xml` file is *missing* members
present in previous API versions, e.g.
`java.lang.StringBuilder.trimToSize()` is not mentioned in API-R,
while it *is* mentioned in API-29 and the "global"
`platform-tools/api/api-versions.xml`.
Try to improve sanity for this conundrum by allowing
`generator --apiversions` to be specified multiple times, e.g. this
diff to apply to xamarin-android:
diff --git a/src/Mono.Android/Mono.Android.targets b/src/Mono.Android/Mono.Android.targets
index 8735c2ae..baae759b 100644
--- a/src/Mono.Android/Mono.Android.targets
+++ b/src/Mono.Android/Mono.Android.targets
@@ -78,10 +78,13 @@
Inputs="metadata;enumflags;map.csv;methodmap.csv;$(IntermediateOutputPath)mcw\api.xml"
Outputs="$(IntermediateOutputPath)mcw\Mono.Android.projitems">
<MakeDir Directories="$(IntermediateOutputPath)mcw" />
- <PropertyGroup>
- <_ApiVersions Condition="Exists('$(AndroidSdkDirectory)\platforms\android-$(AndroidPlatformId)\data\api-versions.xml')">"$(AndroidSdkDirectory)\platforms\android-$(AndroidPlatformId)\data\api-versions.xml"</_ApiVersions>
- <_ApiVersions Condition="'$(_ApiVersions)'==''">"$(AndroidSdkDirectory)\platform-tools\api\api-versions.xml"</_ApiVersions>
- </PropertyGroup>
+ <ItemGroup>
+ <_ApiVersion Include="$(AndroidSdkDirectory)\platform-tools\api\api-versions.xml" />
+ <_ApiVersion
+ Condition="Exists('$(AndroidSdkDirectory)\platforms\android-$(AndroidPlatformId)\data\api-versions.xml')"
+ Include="$(AndroidSdkDirectory)\platforms\android-$(AndroidPlatformId)\data\api-versions.xml"
+ />
+ </ItemGroup>
<PropertyGroup>
<Generator>"$(XAInstallPrefix)xbuild\Xamarin\Android\generator.exe"</Generator>
<_GenFlags>--public --product-version=7</_GenFlags>
@@ -91,7 +94,7 @@
<_Fixup>--fixup=metadata</_Fixup>
<_Enums1>--preserve-enums --enumflags=enumflags --enumfields=map.csv --enummethods=methodmap.csv</_Enums1>
<_Enums2>--enummetadata=$(IntermediateOutputPath)mcw\enummetadata</_Enums2>
- <_Versions>--apiversions=$(_ApiVersions)</_Versions>
+ <_Versions>@(_ApiVersion->'--apiversions="%(Identity)"', ' ')</_Versions>
<_Annotations>--annotations="$(AndroidSdkDirectory)\platform-tools\api\annotations.zip"</_Annotations>
<_Assembly>--assembly="Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"</_Assembly>
<_TypeMap>--type-map-report=$(IntermediateOutputPath)mcw\type-mapping.txt</_TypeMap>
The `generator --apiversions` files are applied in order, with *later*
versions overriding/replacing earlier versions. This is why
`platform-tools/api/api-versions.xml` is present *first*.generator --apiversions
1 parent b33d183 commit 568d24a
2 files changed
+6
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | 56 | | |
58 | 57 | | |
59 | 58 | | |
| |||
157 | 156 | | |
158 | 157 | | |
159 | 158 | | |
160 | | - | |
| 159 | + | |
161 | 160 | | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
29 | 31 | | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| |||
138 | 141 | | |
139 | 142 | | |
140 | 143 | | |
141 | | - | |
| 144 | + | |
142 | 145 | | |
143 | 146 | | |
144 | 147 | | |
| |||
0 commit comments