Commit b7138f1
authored
Fixes: dotnet/maui#10901
Context: https://r8.googlesource.com/r8/+/refs/tags/3.3.75/src/main/java/com/android/tools/r8/BaseCompilerCommandParser.java#246
Building a .NET MAUI project such as:
dotnet new maui
dotnet build -c Release -f net6.0-android -p:AndroidLinkMode=r8
Results in build warnings from R8 such as:
R8 : warning : Missing class androidx.window.extensions.WindowExtensions
In 92bc705, we already had attempted to silence warnings from R8:
R8 : warning : Resource 'META-INF/MANIFEST.MF' already exists.
At the time, there was no option to hide warnings, but now there is!
--map-diagnostics[:<type>] <from-level> <to-level>
# Map diagnostics of <type> (default any) reported as
# <from-level> to <to-level> where <from-level> and
# <to-level> are one of 'info', 'warning', or 'error' and the
# optional <type> is either the simple or fully qualified
# Java type name of a diagnostic. If <type> is unspecified,
# all diagnostics at <from-level> will be mapped.
# Note that fatal compiler errors cannot be mapped.
We can pass:
--map-diagnostics warning info
Which can be done in existing apps via:
<AndroidD8ExtraArguments>--map-diagnostics warning info</AndroidD8ExtraArguments>
<AndroidR8ExtraArguments>--map-diagnostics warning info</AndroidR8ExtraArguments>
To solve this problem, let's create a new `$(AndroidD8IgnoreWarnings)`
MSBuild property and make use of one we already have
`$(AndroidR8IgnoreWarnings)`:
<ItemGroup>
<_AndroidD8MapDiagnostics Condition=" '$(AndroidD8IgnoreWarnings)' == 'true' " Include="warning" To="info" />
<_AndroidR8MapDiagnostics Condition=" '$(AndroidR8IgnoreWarnings)' == 'true' " Include="warning" To="info" />
</ItemGroup>
We can then use these item groups to pass `--map-diagnostics` as
appropriate. Developers can turn off either property to disable this
behavior.
We can then remove the weird `Regex` code added in 92bc705.
The existing tests from 92bc705 should also be sufficient for
testing this change.
1 parent 22f2001 commit b7138f1
File tree
4 files changed
+34
-16
lines changed- Documentation/guides/building-apps
- src/Xamarin.Android.Build.Tasks
- Tasks
4 files changed
+34
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1110 | 1110 | | |
1111 | 1111 | | |
1112 | 1112 | | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
1113 | 1121 | | |
1114 | 1122 | | |
1115 | 1123 | | |
| |||
1118 | 1126 | | |
1119 | 1127 | | |
1120 | 1128 | | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
1121 | 1132 | | |
1122 | 1133 | | |
| 1134 | + | |
| 1135 | + | |
1123 | 1136 | | |
1124 | 1137 | | |
1125 | 1138 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
128 | 123 | | |
| 124 | + | |
| 125 | + | |
129 | 126 | | |
130 | 127 | | |
131 | 128 | | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
| 264 | + | |
264 | 265 | | |
265 | 266 | | |
266 | 267 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
51 | 56 | | |
52 | 57 | | |
53 | 58 | | |
| |||
77 | 82 | | |
78 | 83 | | |
79 | 84 | | |
| 85 | + | |
80 | 86 | | |
81 | 87 | | |
82 | 88 | | |
| |||
96 | 102 | | |
97 | 103 | | |
98 | 104 | | |
| 105 | + | |
99 | 106 | | |
100 | 107 | | |
101 | 108 | | |
| |||
0 commit comments