Commit 8df9772
[illink] Move
Migrate `FixLegacyResourceDesignerStep` out of the ILLink trimmer process
and into PostTrimmingPipeline, continuing the work in #10842 to remove
custom ILLink steps. The step now runs after ILLink via a thin wrapper
(PostTrimmingFixLegacyResourceDesignerStep) that calls
ProcessAssemblyDesigner() directly, matching the former ILLink behavior.
- Remove all #if ILLINK conditionals from FixLegacyResourceDesignerStep,
LinkDesignerBase, and BaseStep
- Remove FixLegacyResourceDesignerStep and LinkDesignerBase from the
ILLink project (no longer compiled as a trimmer step)
- Add UseDesignerAssembly property to PostTrimmingPipeline task
- Wire AndroidUseDesignerAssembly through targets to PostTrimmingPipeline
- Remove _TrimmerCustomSteps entry for FixLegacyResourceDesignerStep
### [targets] Fix NativeAOT designer assembly trimming
In NativeAOT builds, _AddResourceDesignerToPublishFiles ran after
_ComputeManagedAssemblyToLink, so the designer assembly was not in
ManagedAssemblyToLink. ILLink skipped the designer assembly entirely
and did not rewrite its netstandard references.
Fix by adding _AddResourceDesignerToPublishFiles to _PrepareLinking's
DependsOnTargets, so the designer is passed to ILLink.
### Fix merge conflict: remove FixAbstractMethodsStep from ILLink csproj
FixAbstractMethodsStep was moved from ILLink to the post-trim pipeline
on main (7ae24aa). The merge conflict resolution incorrectly kept the
Compile include, but the file now uses types not available in the ILLink
project (IAssemblyModifierPipelineStep, StepContext, Properties.Resources).
### Root designer assembly to prevent ILLink from trimming resource properties
FixLegacyResourceDesignerStep now runs in PostTrimmingPipeline (after ILLink)
instead of as an ILLink custom step. Previously, the step ran before MarkStep
and rewrote library assemblies to reference designer properties, which caused
MarkStep to preserve them. Now that the rewriting happens after ILLink, we
must root the designer assembly so all resource properties survive trimming.
Add TrimmerRootAssembly for the designer in _AddResourceDesignerToPublishFiles.
This keeps IsTrimmable=true (action=link) so ILLink still rewrites the
netstandard assembly reference, but roots all types so nothing is trimmed.
An alternative approach would be to run FixLegacyResourceDesignerStep before
ILLink instead of after. That would allow ILLink to trim unused resource
properties from the designer (since the rewritten references would already be
in place for MarkStep), but it would also process resource references in
assemblies that ILLink may later remove entirely.
### Use TrimmerRootDescriptor instead of TrimmerRootAssembly for designer assembly
TrimmerRootAssembly (-a flag) makes the designer an entry point, which
causes ILLink to retain netstandard.dll as a dependency, leaking it into
the APK (+19KB). TrimmerRootDescriptor (-x flag) preserves all designer
types/members without making it an entry point, avoiding the regression.
### Update SkiaSharp test to expect XA8000 instead of IL8000 for release builds
FixLegacyResourceDesignerStep now runs in PostTrimmingPipeline (MSBuild
task) instead of inside ILLink, so the error code is always XA8000
regardless of build configuration.
### Fix incremental build: use WriteOnlyWhenDifferent for linker descriptor
WriteLinesToFile was regenerating the TrimmerRootDescriptor XML on every
build, changing its timestamp and causing ILLink to re-run on incremental
builds. Adding WriteOnlyWhenDifferent preserves the timestamp when the
content hasn't changed.
- Add TODO to simplify TrimmerRootDescriptor once dotnet/runtime#126518 is fixed
### Update APK size reference baselines
FixLegacyResourceDesignerStep now runs post-ILLink with preserve=all,
keeping all designer properties instead of only those referenced by
libraries. This increases the designer assembly from ~19KB to ~135KB
in the XForms MonoVM test app (1% of total APK size). Other baselines
updated for SDK changes from the main branch merge.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>FixLegacyResourceDesignerStep to post-trim pipeline (#11059)1 parent 7bc5a9e commit 8df9772
File tree
15 files changed
+154
-141
lines changed- src
- Microsoft.Android.Sdk.ILLink
- Xamarin.Android.Build.Tasks
- Linker
- External/Linker.Steps
- MonoDroid.Tuner
- MSBuild/Xamarin/Android
- Microsoft.Android.Sdk/targets
- Tasks
- Tests/Xamarin.ProjectTools/Resources/Base
- tests/MSBuildDeviceIntegration/Tests
15 files changed
+154
-141
lines changedLines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
| |||
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | 92 | | |
96 | | - | |
97 | 93 | | |
98 | 94 | | |
99 | 95 | | |
Lines changed: 1 addition & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | 17 | | |
21 | | - | |
22 | 18 | | |
23 | 19 | | |
24 | 20 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 21 | + | |
29 | 22 | | |
30 | 23 | | |
31 | 24 | | |
| |||
36 | 29 | | |
37 | 30 | | |
38 | 31 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | 32 | | |
48 | 33 | | |
49 | 34 | | |
| |||
72 | 57 | | |
73 | 58 | | |
74 | 59 | | |
75 | | - | |
76 | 60 | | |
77 | 61 | | |
78 | 62 | | |
| |||
81 | 65 | | |
82 | 66 | | |
83 | 67 | | |
84 | | - | |
85 | 68 | | |
86 | 69 | | |
87 | 70 | | |
| |||
Lines changed: 2 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | 13 | | |
18 | 14 | | |
19 | 15 | | |
20 | 16 | | |
21 | 17 | | |
22 | 18 | | |
23 | 19 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 20 | + | |
29 | 21 | | |
30 | 22 | | |
31 | 23 | | |
32 | 24 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 25 | + | |
38 | 26 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | 27 | | |
43 | | - | |
44 | 28 | | |
45 | 29 | | |
46 | 30 | | |
| |||
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
229 | 239 | | |
230 | 240 | | |
231 | 241 | | |
232 | 242 | | |
233 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
234 | 253 | | |
235 | 254 | | |
236 | 255 | | |
237 | 256 | | |
238 | 257 | | |
239 | 258 | | |
240 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
241 | 266 | | |
242 | 267 | | |
243 | 268 | | |
| |||
Lines changed: 3 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
| 170 | + | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | 207 | | |
214 | 208 | | |
215 | 209 | | |
| |||
254 | 248 | | |
255 | 249 | | |
256 | 250 | | |
257 | | - | |
| 251 | + | |
| 252 | + | |
258 | 253 | | |
259 | 254 | | |
260 | 255 | | |
| |||
Lines changed: 34 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
| 39 | + | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
| |||
100 | 103 | | |
101 | 104 | | |
102 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
103 | 115 | | |
104 | 116 | | |
105 | 117 | | |
| |||
118 | 130 | | |
119 | 131 | | |
120 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
Lines changed: 10 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
Lines changed: 7 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
0 commit comments