Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[xamlc] fix duplicate Mono.Cecil search paths (xamarin#12030)
I was building the Control Gallery and saw: XamlCTask Compiling Xaml, assembly: obj\Debug\netstandard2.0\Xamarin.Forms.Controls.dll Adding searchpath C:\Users\jopepper\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref Adding searchpath C:\Users\jopepper\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref Adding searchpath C:\Users\jopepper\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref Adding searchpath C:\Users\jopepper\.nuget\packages\newtonsoft.json\12.0.3\lib\netstandard2.0 Adding searchpath C:\Users\jopepper\.nuget\packages\nunit\3.12.0\lib\netstandard2.0 Adding searchpath C:\Users\jopepper\.nuget\packages\xam.plugin.deviceinfo\3.0.2\lib\netstandard1.0 Adding searchpath C:\Users\jopepper\.nuget\packages\xam.plugin.deviceinfo\3.0.2\lib\netstandard1.0 Adding searchpath C:\Users\jopepper\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref Adding searchpath C:\Users\jopepper\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref ... 122 lines in total. In f330652 there was an attempt to fix this in the past with a `.Distinct()` call, but `Path.GetDirectoryName()` wasn't called first. After reordering things, the `<XamlCTask/>` now prints 9 search paths for the Control Gallery: XamlCTask Compiling Xaml, assembly: obj\Debug\netstandard2.0\Xamarin.Forms.Controls.dll Adding searchpath C:\Users\jopepper\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref Adding searchpath C:\Users\jopepper\.nuget\packages\newtonsoft.json\12.0.3\lib\netstandard2.0 Adding searchpath C:\Users\jopepper\.nuget\packages\nunit\3.12.0\lib\netstandard2.0 Adding searchpath C:\Users\jopepper\.nuget\packages\xam.plugin.deviceinfo\3.0.2\lib\netstandard1.0 Adding searchpath C:\src\Xamarin.Forms\Xamarin.Forms.Core\bin\Debug\netstandard2.0 Adding searchpath C:\src\Xamarin.Forms\Xamarin.Forms.CustomAttributes\bin\Debug\netstandard2.0 Adding searchpath C:\src\Xamarin.Forms\Xamarin.Forms.Maps\bin\Debug\netstandard2.0 Adding searchpath C:\src\Xamarin.Forms\Xamarin.Forms.Platform\bin\Debug\netstandard2.0 Adding searchpath C:\src\Xamarin.Forms\Xamarin.Forms.Xaml\bin\Debug\netstandard2.0 Other changes to `<XamlCTask/>`: * Made `ReferencePath` a `string[]` so that MSBuild can split the item groups for us. This way we don't have to call `string.Split()` and weird (and valid!) separators work such as space characters or %3b. * Removed `DependencyPaths`, as I could not find any usage of it. ~~ Results ~~ I could see small performance difference fixing this. On Windows + .NET framework: Before: 2140 ms XamlCTask 1 calls After: 2074 ms XamlCTask 1 calls On macOS + Mono: Before: 7580 ms XamlCTask 1 calls After: 7480 ms XamlCTask 1 calls My PC is newer/faster than my Mac, but I think this probably saves between 65ms-100ms for `<XamlCTask/>` in the Control Gallery sample.
- Loading branch information