Commit 8140991
authored
[Xamarin.Android.Build.Tasks] require JDK 11 for API-31+ (#6084)
API-31 builds fail when using JDK 1.8 and using AndroidX with:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1728,3):
error JAVAC0000: java.lang.AssertionError: annotationType() : unrecognized Attribute name MODULE (class com.sun.tools.javac.util.SharedNameTable$NameImpl)
There are two plausible solutions to better handle this:
1. Only require JDK 11 when API-31 and AndroidX are being used, or
2. Always required JDK 11 for API-31+
As we believe *most* apps will be using AndroidX, there is little
point to attempting so support (1); (2) it is!
We must require JDK 11 for API-31+.
There are two code paths here: one for "legacy" Xamarin.Android, and
one for .NET 6.
Legacy is straightforward, as we already had a pattern for this, we
just update the `<ValidateJavaVersion/>` task.
For .NET 6, I checked the `$(TargetPlatformVersion)` property for now
and require JDK 11 in that case. When API-31 is stable, we can
probably remove this code and just set this value by default:
<MinimumSupportedJavaVersion Condition=" '$(MinimumSupportedJavaVersion)' == '' ">11.0</MinimumSupportedJavaVersion>
For our unit tests -- most of which would be solution (1) (API-31
and *no* AndroidX use), but many of which started to fail because we
went with solution (2) -- we did one of two things:
1. Use a different `$(TargetFrameworkVersion)` and/or remove
`$(TargetFrameworkVersion)` entirely, or
2. Use a new `BuildTest.AssertTargetFrameworkVersionSupported()`
method which `Assert.Ignore()`s the test if it would not
pass otherwise.1 parent 27e91bb commit 8140991
File tree
10 files changed
+54
-18
lines changed- Documentation/release-notes
- src/Xamarin.Android.Build.Tasks
- Microsoft.Android.Sdk/targets
- Tasks
- Legacy
- Tests/Xamarin.Android.Build.Tests
- Tasks
- Utilities
- tests/MSBuildDeviceIntegration/Tests
10 files changed
+54
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
Lines changed: 2 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
| 53 | + | |
| 54 | + | |
60 | 55 | | |
61 | 56 | | |
62 | 57 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
70 | 75 | | |
71 | 76 | | |
72 | 77 | | |
| |||
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
1143 | 1145 | | |
1144 | 1146 | | |
1145 | 1147 | | |
1146 | | - | |
1147 | | - | |
1148 | 1148 | | |
1149 | 1149 | | |
1150 | 1150 | | |
| |||
2348 | 2348 | | |
2349 | 2349 | | |
2350 | 2350 | | |
| 2351 | + | |
2351 | 2352 | | |
2352 | 2353 | | |
2353 | 2354 | | |
2354 | 2355 | | |
2355 | 2356 | | |
| 2357 | + | |
2356 | 2358 | | |
2357 | 2359 | | |
2358 | 2360 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
481 | | - | |
482 | | - | |
483 | 481 | | |
484 | 482 | | |
485 | 483 | | |
| |||
Lines changed: 21 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
| |||
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
38 | | - | |
| 41 | + | |
39 | 42 | | |
40 | | - | |
| 43 | + | |
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
| |||
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
104 | | - | |
| 107 | + | |
105 | 108 | | |
106 | | - | |
| 109 | + | |
107 | 110 | | |
108 | 111 | | |
109 | 112 | | |
| |||
151 | 154 | | |
152 | 155 | | |
153 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
154 | 168 | | |
155 | 169 | | |
156 | 170 | | |
| |||
184 | 198 | | |
185 | 199 | | |
186 | 200 | | |
187 | | - | |
| 201 | + | |
188 | 202 | | |
189 | 203 | | |
190 | 204 | | |
| |||
429 | 443 | | |
430 | 444 | | |
431 | 445 | | |
| 446 | + | |
432 | 447 | | |
433 | 448 | | |
434 | 449 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
215 | 225 | | |
216 | 226 | | |
217 | 227 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
581 | 581 | | |
582 | 582 | | |
583 | 583 | | |
584 | | - | |
| 584 | + | |
585 | 585 | | |
586 | 586 | | |
587 | 587 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
0 commit comments