Commit aac3e9a
authored
[Java.Interop, Java.Base] Fix xamarin-android integration issues (#929)
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.1 parent bc5bcf4 commit aac3e9a
File tree
8 files changed
+44
-5
lines changed- src
- Java.Base
- Java.Interop
- Java.Interop
- tests/generator-Tests
- Integration-Tests
- SupportFiles
8 files changed
+44
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
94 | 108 | | |
95 | 109 | | |
96 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| 19 | + | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
| |||
Lines changed: 18 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 | + | |
0 commit comments