-
Notifications
You must be signed in to change notification settings - Fork 64
[generator] Allow multiple generator --apiversions
#593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jpobst
merged 1 commit into
dotnet:master
from
jonpryor:jonp-generator-allow-multiple-apiversions
Mar 5, 2020
Merged
[generator] Allow multiple generator --apiversions
#593
jpobst
merged 1 commit into
dotnet:master
from
jonpryor:jonp-generator-allow-multiple-apiversions
Mar 5, 2020
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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*.
gugavaro
approved these changes
Mar 5, 2020
jpobst
approved these changes
Mar 5, 2020
jonpryor
pushed a commit
that referenced
this pull request
Mar 6, 2020
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*.
pjcollins
pushed a commit
that referenced
this pull request
Mar 10, 2020
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*.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context: dotnet/android#4356 (comment)
A "funny" thing was found with API-R: the Android SDK
platforms/android-R/data/api-versions.xmlfile is missing memberspresent 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 --apiversionsto be specified multiple times, e.g. thisdiff to apply to xamarin-android:
The
generator --apiversionsfiles are applied in order, with laterversions overriding/replacing earlier versions. This is why
platform-tools/api/api-versions.xmlis present first.