Commit 8e54441
committed
[Xamarin.Android.Build.Tasks] combine CheckTargetFrameworks/ResolveAssemblies
Context: https://gist.github.com/jonathanpeppers/a207a8828317460239a12a8b0cc918d7
When reviewing how many times we are using Mono.Cecil to open every
assembly, it was happening 9 times!
Unfortunately it is not as easy as just "caching" something, the
simplest approach for now is to start combining functionality that are
in multiple tasks right now.
A simple first example is the `CheckTargetFrameworks` MSBuild task,
which runs after the `Compile` and `ResolveAssemblies` MSBuild tasks.
`CheckTargetFrameworks` has the job of emitting warnings about
`[assembly: System.Runtime.Versioning.TargetFramework]`. We can easily
do this work in `ResolveAssemblies` as it is already looping over all
the assemblies' custom attributes for other reasons.
Changes to make this happen:
- Removed `CheckTargetFrameworks` and the `_CheckTargetFrameworks`
target, adding the required `TargetFrameworkVersion` and
`ProjectFile` properties to `ResolveAssemblies`.
- Added a new `CheckAssemblyAttributes` where we can add to a `switch`
statement for new attribute types in the future as needed.
- Added a dictionary of `api_levels`, and copied over the logic from
`CheckTargetFrameworks`
Before:
105 ms CheckTargetFrameworks 1 calls
188 ms ResolveAssemblies 1 calls
After:
216 ms ResolveAssemblies 1 calls
I timed the `tests/Xamarin.Forms-Performance-Integration` project in
this repository: a build with no changes.
Since `CheckTargetFrameworks` is removed completely, we can avoid the
time it was taking to open every assembly again.
This saves around 77ms.1 parent 38bc7d0 commit 8e54441
File tree
4 files changed
+51
-94
lines changed- src/Xamarin.Android.Build.Tasks
- Tasks
4 files changed
+51
-94
lines changedLines changed: 0 additions & 76 deletions
This file was deleted.
Lines changed: 49 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
31 | 37 | | |
32 | 38 | | |
33 | 39 | | |
| |||
122 | 128 | | |
123 | 129 | | |
124 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
125 | 139 | | |
126 | 140 | | |
127 | 141 | | |
| |||
149 | 163 | | |
150 | 164 | | |
151 | 165 | | |
| 166 | + | |
152 | 167 | | |
153 | 168 | | |
154 | 169 | | |
| |||
198 | 213 | | |
199 | 214 | | |
200 | 215 | | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
| 216 | + | |
| 217 | + | |
208 | 218 | | |
209 | 219 | | |
210 | 220 | | |
| |||
245 | 255 | | |
246 | 256 | | |
247 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
248 | 290 | | |
249 | 291 | | |
250 | 292 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
444 | 444 | | |
445 | 445 | | |
446 | 446 | | |
447 | | - | |
448 | 447 | | |
449 | 448 | | |
450 | 449 | | |
| |||
Lines changed: 2 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | 40 | | |
42 | 41 | | |
43 | 42 | | |
| |||
487 | 486 | | |
488 | 487 | | |
489 | 488 | | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | 489 | | |
499 | 490 | | |
500 | 491 | | |
| |||
1891 | 1882 | | |
1892 | 1883 | | |
1893 | 1884 | | |
| 1885 | + | |
| 1886 | + | |
1894 | 1887 | | |
1895 | 1888 | | |
1896 | 1889 | | |
| |||
2143 | 2136 | | |
2144 | 2137 | | |
2145 | 2138 | | |
2146 | | - | |
2147 | 2139 | | |
2148 | 2140 | | |
2149 | 2141 | | |
| |||
0 commit comments