-
Notifications
You must be signed in to change notification settings - Fork 564
Bump to xamarin/Java.Interop/main@bc5bcf4f #6549
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
Conversation
Changes: dotnet/java-interop@7f1a5ab...bc5bcf4 * dotnet/java-interop@bc5bcf4f: [Java.Base] Begin binding JDK-11 java.base module (dotnet#909) * dotnet/java-interop@af91b9c2: [ci] Use descriptive test run titles. (dotnet#926) * dotnet/java-interop@aae8f251: [Java.Interop.Tools.Generator] Add some enumification helper methods (dotnet#866) * dotnet/java-interop@111ebca8: [Java.Interop] Treat warnings as errors. (dotnet#925) * dotnet/java-interop@7a32bb97: [java-source-utils] Transform XML using XSLT (dotnet#924) * dotnet/java-interop@7f55b2dc: [logcat-parse] Use C# verbatim strings for paths (dotnet#927) * dotnet/java-interop@2601146b: [java-source-utils] Fix regresion from 77c9c5fa (dotnet#923)
Context: dotnet/android#6549 When attempting to bump xamarin-android to use bc5bcf4, the build failed because bc5bcf4 added a "duplicate" type `Java.Interop.JavaTypeParametersAttribute`: error CS0433: The type 'JavaTypeParametersAttribute' exists in both 'Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' and 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'. The plan was to use type forwarders for this type from `Mono.Android.dll` to `Java.Interop.dll`, but in retrospect this sounds like a potential "forward-incompatible ABI break", as assemblies built against the newer `Mono.Android.dll` (with type forwarders) won't be usable on previous Xamarin.Android SDKs. Make `JavaTypeParametersAttribute` conditional on `NET`, so that it's only included in .NET 6 builds. .NET SDK for Android will then use type forwarders, which won't be an issue as there's no previous .NET release to be forward compatible with.
42b5532 to
fd17f1a
Compare
Context: dotnet/android#6549 When attempting to bump xamarin-android to use bc5bcf4, the build failed because bc5bcf4 added a "duplicate" type `Java.Interop.JavaTypeParametersAttribute`: error CS0433: The type 'JavaTypeParametersAttribute' exists in both 'Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' and 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'. The plan was to use type forwarders for this type from `Mono.Android.dll` to `Java.Interop.dll`, but in retrospect this sounds like a potential "forward-incompatible ABI break" (e56a8c8) as assemblies built against the newer `Mono.Android.dll` (with type forwarders) won't be usable on previous Xamarin.Android SDKs. Make `JavaTypeParametersAttribute` conditional on `NET`, so that it's only included in .NET 6 builds. .NET SDK for Android will then use type forwarders, which won't be an issue as there's no previous .NET release to be forward compatible with. Update `tests/generator-Tests` so that `JavaTypeParametersAttribute` is once again provided for non-`JAVA_INTEROP1` builds.
Context: dotnet/android#6549 When attempting to bump xamarin-android to use bc5bcf4, the build failed because bc5bcf4 added a "duplicate" type `Java.Interop.JavaTypeParametersAttribute`: error CS0433: The type 'JavaTypeParametersAttribute' exists in both 'Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' and 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'. The plan was to use type forwarders for this type from `Mono.Android.dll` to `Java.Interop.dll`, but in retrospect this sounds like a potential "forward-incompatible ABI break" (e56a8c8) as assemblies built against the newer `Mono.Android.dll` (with type forwarders) won't be usable on previous Xamarin.Android SDKs. Make `JavaTypeParametersAttribute` conditional on `NET`, so that it's only included in .NET 6 builds. .NET SDK for Android will then use type forwarders, which won't be an issue as there's no previous .NET release to be forward compatible with. Update `tests/generator-Tests` so that `JavaTypeParametersAttribute` is once again provided for non-`NET` builds.
|
Commit message: Changes: https://github.com/xamarin/java.interop/compare/7f1a5ab1606e4055eb4705aeafa7a22117998a33...aac3e9acca503c38c5616ef84d8af28197da254c
* xamarin/java.interop@aac3e9ac: [Java.Interop, Java.Base] Fix xamarin-android integration issues (#929)
* xamarin/java.interop@bc5bcf4f: [Java.Base] Begin binding JDK-11 java.base module (#909)
* xamarin/java.interop@af91b9c2: [ci] Use descriptive test run titles. (#926)
* xamarin/java.interop@aae8f251: [Java.Interop.Tools.Generator] Add some enumification helper methods (#866)
* xamarin/java.interop@111ebca8: [Java.Interop] Treat warnings as errors. (#925)
* xamarin/java.interop@7a32bb97: [java-source-utils] Transform XML using XSLT (#924)
* xamarin/java.interop@7f55b2dc: [logcat-parse] Use C# verbatim strings for paths (#927)
* xamarin/java.interop@2601146b: [java-source-utils] Fix regresion from 77c9c5fa (#923)
(So many inadvertent issues as part of this bump…)
xamarin/java.interop@bc5bcf4f added an *altered*
`Java.Interop.JavaTypeParametersAttribute` custom attribute, altered
to "appease" various Code Analysis warnings such as [CA1813][0]
"Avoid unsealed attributes".
This introduction caused some unit tests to fail to build:
error CS0433: The type 'JavaTypeParametersAttribute' exists in both
'Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' and
'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'
[C:\…\temp\LibraryProjectZipWithLint\BindingsProject\BindingsProject.csproj]
The original idea had been to use [type forwarders][1], so that
`Java.Interop.JavaTypeParametersAttribute` from `Mono.Android.dll`
would be forwarded to the same type in `Java.Interop.dll`. This idea
was rejected after further consideration, as it would likely break
[forward compatibility][2] (xamarin/Java.Interop@e56a8c8e).
xamarin/java.interop@aac3e9ac fixes this by making
`JavaTypeParametersAttribute` conditional on `NET`, causing the type
to only be present when targeting .NET 6+. `Mono.Android.dll` for
.NET 6 -- and *not* Classic Xamarin.Android -- can then use a type
forwarder. This can be done because there's no forward
compatibility constraint on .NET 6.
However, by making `JavaTypeParametersAttribute` conditional on `NET`,
the `_CheckApiCompatibility` target started failing -- rightfully! --
because the `JavaTypeParametersAttribute` type had been removed.
"Worse", there was no way to accept this change in e.g.
`tests/api-compatibility/acceptable-breakages-vReference.txt`,
because the `<CheckApiCompatibility/>` task requires that there be no
extra entries.
Square this circle by adding a `CheckApiCompatibility.TargetFramework`
property, and looking for
`acceptable-breakages-*-{TargetFramework}.txt` *before* looking for
`acceptable-breakages-*.txt`. This allows us to special-case the
acceptable breakages based on `$(TargetFramework)`.
Finally, update `azure-pipelines.yaml` so that the `java-source-utils`
unit tests are *not* run on Windows. This is because they currently
fail on Windows, which is something we'll worry about later. For now,
disable the `java-source-utils` tests when building on Windows.
[0]: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1813
[1]: https://docs.microsoft.com/en-us/dotnet/standard/assembly/type-forwarding
[2]: https://en.wikipedia.org/wiki/Forward_compatibility |
|
The attempted fix didn't fix, e.g. LibraryProjectZipWithLint: What's doubly odd is that when I build locally, my However, the Something fishy is going on… |
|
"Unrelated" (?), Windows fails to build: No idea what's going on there either. |
fd17f1a to
44a7beb
Compare
|
I'm currently assuming that I didn't test the Java.Interop commits I thought I was testing. Or, insanity. In particular, consider: https://github.com/xamarin/java.interop/blob/bc5bcf4f0ef07aab898f2643d2a25f66512d98ed/src/Java.Interop/Java.Interop/JniRuntime.JniMarshalMemberBuilder.cs#L30-L36 This is the [System.Diagnostics.CodeAnalysis.SuppressMessage ("Design", "CA1031:Do not catch general exception types", Justification = "the *.Export assemblies are optional, so we don't care when they cannot be loaded (they are presumably missing)")]
#if NET
[DynamicDependency (DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, "Java.Interop.MarshalMemberBuilder", "Java.Interop.Export")]
[UnconditionalSuppressMessage ("Trimming", "IL2026", Justification = "DynamicDependency should preserve the constructor.")]
[UnconditionalSuppressMessage ("Trimming", "IL2035", Justification = "Java.Interop.Export.dll is not always present.")]
#endif
partial void SetMarshalMemberBuilder (CreationOptions options)Note in particular that it has custom attributes wrapped in Also note that my fix for Thus, the only way (Which is differently odd, as On the assumption that I Did Something Wrong, I've re-pushed the commit, using the current latest Java.Interop commit. Hopefully things will be saner? |
|
Only the macOS build has finished at the time of this writing, but I think my guess was correct: when I download the updated |
Context: dotnet/android#6549 Corresponds to jonpryor/xamarin-android@44a7beb
44a7beb to
0acaa76
Compare
Context: dotnet/java-interop#929 See if dotnet/java-interop#929 + type forwarders fixes the build failure originally observed: error CS0433: The type 'JavaTypeParametersAttribute' exists in both 'Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' and 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' [C:\a\_work\1\a\TestRelease\12-07_04.08.15\temp\LibraryProjectZipWithLint\BindingsProject\BindingsProject.csproj]
0acaa76 to
32bca42
Compare
1537620 to
8e3e709
Compare
"Fixes" failures on Windows RunTests: "C:\a\_work\2\s\external\Java.Interop\build-tools\gradle\gradlew" --stacktrace --no-daemon test … > Task :test FAILED … BUILD FAILED in 7s C:\a\_work\2\s\external\Java.Interop\tools\java-source-utils\java-source-utils.targets(43,5): error MSB3073: The command ""C:\a\_work\2\s\external\Java.Interop\build-tools\gradle\gradlew" --stacktrace --no-daemon test" exited with code 1. [C:\a\_work\2\s\external\Java.Interop\tools\java-source-utils\java-source-utils.csproj]
8e3e709 to
4f64a4c
Compare
Context: dotnet/android#6549 Context: 7f1a5ab...bc5bcf4 When attempting to bump xamarin-android from 7f1a5ab to bc5bcf4, the build failed for a number of reasons, including because bc5bcf4 added a "duplicate" type `Java.Interop.JavaTypeParametersAttribute`, which caused unit tests to fail: error CS0433: The type 'JavaTypeParametersAttribute' exists in both 'Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' and 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'. The plan was to use type forwarders for this type from `Mono.Android.dll` to `Java.Interop.dll`, but in retrospect this sounds like a potential "forward-incompatible ABI break" (e56a8c8), as assemblies built against the newer `Mono.Android.dll` (with type forwarders) won't be usable on previous Xamarin.Android SDKs. Make `JavaTypeParametersAttribute` conditional on `NET`, so that it's only included in .NET 6 builds. .NET SDK for Android will then use type forwarders, which won't be an issue as there's no previous .NET release to be forward compatible with. Update `tests/generator-Tests` so that `JavaTypeParametersAttribute` is once again provided for non-`NET` builds. Additionally, commit 111ebca enabled `$(TreatWarningsAsErrors)`=True, which had an inadvertent side effect of preventing VS2019 from building the Java.Interop repo, as warning CS8032 is now an error: error CS8032: An instance of analyzer System.Text.Json.SourceGeneration.JsonSourceGenerator cannot be created from C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.0\analyzers\dotnet\cs\System.Text.Json.SourceGeneration.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. As it happens, the xamarin-android Windows PR builds are on VS2019, and thus promptly broke. Fix this error by adding CS8032 to `$(NoWarn)`, and updating various `.csproj` files so that the `$(NoWarn)` in `Directory.Build.props` is used everywhere needed. Finally, update `Java.Base.targets` so that it looks for `class-parse.dll` and `generator.dll` from `$(UtilityOutputFullPath)` *not* `$(ToolOutputFullPath)`. `class-parse.csproj` and `generator.csproj` both set `$(OutputPath)` to `$(UtilityOutputFullPath)`, and the correct path must be used in order for `Java.Base.targets` to find the required utilities.
Changes: dotnet/java-interop@7f1a5ab...bc5bcf4