xamarin-macios/msbuild/ILMerge.targets

76 строки
6.1 KiB
Plaintext
Исходник Обычный вид История

[msbuild] Build the MSBuild task assemblies for netstandard2.0. (#7706) * Bump Xamarin.MacDev. New commits in xamarin/Xamarin.MacDev: * xamarin/Xamarin.MacDev@210c664 Adds net451 to Xamarin.MacDev.csproj * xamarin/Xamarin.MacDev@64db365 [winios] Changes provisioning profiles default path * xamarin/Xamarin.MacDev@d34430a Switch to short-form projects and build for both net461 and netstandard2.0. (#68) Diff: https://github.com/xamarin/Xamarin.MacDev/compare/0f578f51e63b6ff93014782dbc9378e6b6bc6d75..210c664e56117d3a1a7f6dd002109eb444dbdc17 * [msbuild] Update to latest Mono.Cecil. The older version doesn't support netstandard2.0. No code changes were required. * [msbuild] Remove unused usings. * [msbuild] Make ILMerge work when building for netstandard2.0. Also unify/deduplicate the ILMerge logic between Xamarin.iOS and Xamarin.Mac. * [msbuild] Build for netstandard2.0 in addition to net461. * [msbuild] Use custom project configurations to support running the tests for both netstandard2.0 and net461. Use custom project configurations to support running the tests for when the tasks assembly is built for netstandard2.0 and net461. * [tests] Make command-line based 'make test-ios-tasks' run tests for both netstandard2.0 and net461. * [xharness] Add test configuration to run iOS MSBuild tests using either netstandard2.0 or net461. * [msbuild] Make the netstandard2.0-buils task assemblies the default. * [msbuild] ILRepack lib assemblies, not ref assemblies. Ask MSBuild to copy lib assemblies to the output folder when building for netstandard2.0, this way we can easily find the actual implementation libraries to pass to ILRepack. * [msbuild] Merge System.Text.Encodings.Web.dll as well. * [xharness] Fix build of MSBuild tests for iOS.
2020-01-16 20:22:48 +03:00
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<!-- <PackageReference Include="ILRepack" Version="2.0.18" /> -->
<!-- The current version of ILRepack can't handle portable pdbs. This will be fixed when https://github.com/gluck/il-repack/pull/236 is merged and an updated NuGet is available -->
<!-- In the meantime use an ILRepack fork which has the fix already -->
<PackageReference Include="ILRepack.MSBuild.Task" Version="2.0.13" />
[msbuild] Build the MSBuild task assemblies for netstandard2.0. (#7706) * Bump Xamarin.MacDev. New commits in xamarin/Xamarin.MacDev: * xamarin/Xamarin.MacDev@210c664 Adds net451 to Xamarin.MacDev.csproj * xamarin/Xamarin.MacDev@64db365 [winios] Changes provisioning profiles default path * xamarin/Xamarin.MacDev@d34430a Switch to short-form projects and build for both net461 and netstandard2.0. (#68) Diff: https://github.com/xamarin/Xamarin.MacDev/compare/0f578f51e63b6ff93014782dbc9378e6b6bc6d75..210c664e56117d3a1a7f6dd002109eb444dbdc17 * [msbuild] Update to latest Mono.Cecil. The older version doesn't support netstandard2.0. No code changes were required. * [msbuild] Remove unused usings. * [msbuild] Make ILMerge work when building for netstandard2.0. Also unify/deduplicate the ILMerge logic between Xamarin.iOS and Xamarin.Mac. * [msbuild] Build for netstandard2.0 in addition to net461. * [msbuild] Use custom project configurations to support running the tests for both netstandard2.0 and net461. Use custom project configurations to support running the tests for when the tasks assembly is built for netstandard2.0 and net461. * [tests] Make command-line based 'make test-ios-tasks' run tests for both netstandard2.0 and net461. * [xharness] Add test configuration to run iOS MSBuild tests using either netstandard2.0 or net461. * [msbuild] Make the netstandard2.0-buils task assemblies the default. * [msbuild] ILRepack lib assemblies, not ref assemblies. Ask MSBuild to copy lib assemblies to the output folder when building for netstandard2.0, this way we can easily find the actual implementation libraries to pass to ILRepack. * [msbuild] Merge System.Text.Encodings.Web.dll as well. * [xharness] Fix build of MSBuild tests for iOS.
2020-01-16 20:22:48 +03:00
</ItemGroup>
<PropertyGroup>
<!-- Unfortunately the ILRepack.MSBuild.Task package doesn't define any variables that help us find its ilrepack.exe executable, so manually create this variable (which the IRepack package defines, so remove this workaround can be removed once we switch back to ILRepack) -->
<ILRepack>$(HOME)/.nuget/packages/ilrepack.msbuild.task/2.0.13/tools/ilrepack.exe</ILRepack>
</PropertyGroup>
[msbuild] Build the MSBuild task assemblies for netstandard2.0. (#7706) * Bump Xamarin.MacDev. New commits in xamarin/Xamarin.MacDev: * xamarin/Xamarin.MacDev@210c664 Adds net451 to Xamarin.MacDev.csproj * xamarin/Xamarin.MacDev@64db365 [winios] Changes provisioning profiles default path * xamarin/Xamarin.MacDev@d34430a Switch to short-form projects and build for both net461 and netstandard2.0. (#68) Diff: https://github.com/xamarin/Xamarin.MacDev/compare/0f578f51e63b6ff93014782dbc9378e6b6bc6d75..210c664e56117d3a1a7f6dd002109eb444dbdc17 * [msbuild] Update to latest Mono.Cecil. The older version doesn't support netstandard2.0. No code changes were required. * [msbuild] Remove unused usings. * [msbuild] Make ILMerge work when building for netstandard2.0. Also unify/deduplicate the ILMerge logic between Xamarin.iOS and Xamarin.Mac. * [msbuild] Build for netstandard2.0 in addition to net461. * [msbuild] Use custom project configurations to support running the tests for both netstandard2.0 and net461. Use custom project configurations to support running the tests for when the tasks assembly is built for netstandard2.0 and net461. * [tests] Make command-line based 'make test-ios-tasks' run tests for both netstandard2.0 and net461. * [xharness] Add test configuration to run iOS MSBuild tests using either netstandard2.0 or net461. * [msbuild] Make the netstandard2.0-buils task assemblies the default. * [msbuild] ILRepack lib assemblies, not ref assemblies. Ask MSBuild to copy lib assemblies to the output folder when building for netstandard2.0, this way we can easily find the actual implementation libraries to pass to ILRepack. * [msbuild] Merge System.Text.Encodings.Web.dll as well. * [xharness] Fix build of MSBuild tests for iOS.
2020-01-16 20:22:48 +03:00
<Target Name="ILRepack" BeforeTargets="CopyFilesToOutputDirectory" Inputs="@(IntermediateAssembly -&gt; '%(FullPath)')" Outputs="$(IntermediateOutputPath)ilrepack.txt" Returns="@(MergedAssemblies)" Condition="Exists(@(IntermediateAssembly -&gt; '%(FullPath)')) And '$(ILRepack)' != 'false'">
<ItemGroup>
<NetstandardPath Include="@(ReferencePath -&gt; '%(RootDir)%(Directory)')" Condition="'%(FileName)%(Extension)' == 'netstandard.dll'" />
</ItemGroup>
<PropertyGroup>
<NetstandardDirectory>@(NetstandardPath)</NetstandardDirectory>
</PropertyGroup>
<!-- The assemblies are in a very different place when building for netstandard2.0, which means we need different logic to find them too -->
<ItemGroup Condition="$(TargetFramework.StartsWith ('netstandard'))">
[msbuild] Build the MSBuild task assemblies for netstandard2.0. (#7706) * Bump Xamarin.MacDev. New commits in xamarin/Xamarin.MacDev: * xamarin/Xamarin.MacDev@210c664 Adds net451 to Xamarin.MacDev.csproj * xamarin/Xamarin.MacDev@64db365 [winios] Changes provisioning profiles default path * xamarin/Xamarin.MacDev@d34430a Switch to short-form projects and build for both net461 and netstandard2.0. (#68) Diff: https://github.com/xamarin/Xamarin.MacDev/compare/0f578f51e63b6ff93014782dbc9378e6b6bc6d75..210c664e56117d3a1a7f6dd002109eb444dbdc17 * [msbuild] Update to latest Mono.Cecil. The older version doesn't support netstandard2.0. No code changes were required. * [msbuild] Remove unused usings. * [msbuild] Make ILMerge work when building for netstandard2.0. Also unify/deduplicate the ILMerge logic between Xamarin.iOS and Xamarin.Mac. * [msbuild] Build for netstandard2.0 in addition to net461. * [msbuild] Use custom project configurations to support running the tests for both netstandard2.0 and net461. Use custom project configurations to support running the tests for when the tasks assembly is built for netstandard2.0 and net461. * [tests] Make command-line based 'make test-ios-tasks' run tests for both netstandard2.0 and net461. * [xharness] Add test configuration to run iOS MSBuild tests using either netstandard2.0 or net461. * [msbuild] Make the netstandard2.0-buils task assemblies the default. * [msbuild] ILRepack lib assemblies, not ref assemblies. Ask MSBuild to copy lib assemblies to the output folder when building for netstandard2.0, this way we can easily find the actual implementation libraries to pass to ILRepack. * [msbuild] Merge System.Text.Encodings.Web.dll as well. * [xharness] Fix build of MSBuild tests for iOS.
2020-01-16 20:22:48 +03:00
<!-- I don't like to have a hard-coded list of assemblies to merge, but I couldn't find a way to calculate it -->
<MergedAssemblies Include="@(ReferencePath)" Condition="'%(FileName)' == 'Xamarin.MacDev.Tasks.Core'" />
<MergedAssemblies Include="@(ReferencePath)" Condition="'%(FileName)' == 'Xamarin.MacDev.Tasks'" />
<MergedAssemblies Include="@(ReferencePath)" Condition="'%(FileName)' == '$(AssemblyName).Core'" /> <!-- Use AssemblyName so that the exact same logic works for both Xamarin.iOS.Tasks.dll and Xamarin.Mac.Tasks.dll -->
<MergedAssemblies Include="@(ReferencePath)" Condition="'%(FileName)' == 'Xamarin.MacDev'" />
<MergedAssemblies Include="$(OutputPath)/Microsoft.Bcl.AsyncInterfaces.dll" />
<MergedAssemblies Include="$(OutputPath)/System.Buffers.dll" />
<MergedAssemblies Include="$(OutputPath)/System.Memory.dll" />
<MergedAssemblies Include="$(OutputPath)/System.Numerics.Vectors.dll" />
<MergedAssemblies Include="$(OutputPath)/System.Runtime.CompilerServices.Unsafe.dll" />
<MergedAssemblies Include="$(OutputPath)/System.Text.Json.dll" />
<MergedAssemblies Include="$(OutputPath)/System.Threading.Tasks.Extensions.dll" />
<MergedAssemblies Include="$(OutputPath)/System.Text.Encodings.Web.dll" />
<MergedAssemblies Include="@(ReferencePath)" Condition="'%(Extension)' == '.dll' And $([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('Mono.Cecil', StringComparison.OrdinalIgnoreCase))" />
[msbuild] Build the MSBuild task assemblies for netstandard2.0. (#7706) * Bump Xamarin.MacDev. New commits in xamarin/Xamarin.MacDev: * xamarin/Xamarin.MacDev@210c664 Adds net451 to Xamarin.MacDev.csproj * xamarin/Xamarin.MacDev@64db365 [winios] Changes provisioning profiles default path * xamarin/Xamarin.MacDev@d34430a Switch to short-form projects and build for both net461 and netstandard2.0. (#68) Diff: https://github.com/xamarin/Xamarin.MacDev/compare/0f578f51e63b6ff93014782dbc9378e6b6bc6d75..210c664e56117d3a1a7f6dd002109eb444dbdc17 * [msbuild] Update to latest Mono.Cecil. The older version doesn't support netstandard2.0. No code changes were required. * [msbuild] Remove unused usings. * [msbuild] Make ILMerge work when building for netstandard2.0. Also unify/deduplicate the ILMerge logic between Xamarin.iOS and Xamarin.Mac. * [msbuild] Build for netstandard2.0 in addition to net461. * [msbuild] Use custom project configurations to support running the tests for both netstandard2.0 and net461. Use custom project configurations to support running the tests for when the tasks assembly is built for netstandard2.0 and net461. * [tests] Make command-line based 'make test-ios-tasks' run tests for both netstandard2.0 and net461. * [xharness] Add test configuration to run iOS MSBuild tests using either netstandard2.0 or net461. * [msbuild] Make the netstandard2.0-buils task assemblies the default. * [msbuild] ILRepack lib assemblies, not ref assemblies. Ask MSBuild to copy lib assemblies to the output folder when building for netstandard2.0, this way we can easily find the actual implementation libraries to pass to ILRepack. * [msbuild] Merge System.Text.Encodings.Web.dll as well. * [xharness] Fix build of MSBuild tests for iOS.
2020-01-16 20:22:48 +03:00
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith ('net4'))">
[msbuild] Build the MSBuild task assemblies for netstandard2.0. (#7706) * Bump Xamarin.MacDev. New commits in xamarin/Xamarin.MacDev: * xamarin/Xamarin.MacDev@210c664 Adds net451 to Xamarin.MacDev.csproj * xamarin/Xamarin.MacDev@64db365 [winios] Changes provisioning profiles default path * xamarin/Xamarin.MacDev@d34430a Switch to short-form projects and build for both net461 and netstandard2.0. (#68) Diff: https://github.com/xamarin/Xamarin.MacDev/compare/0f578f51e63b6ff93014782dbc9378e6b6bc6d75..210c664e56117d3a1a7f6dd002109eb444dbdc17 * [msbuild] Update to latest Mono.Cecil. The older version doesn't support netstandard2.0. No code changes were required. * [msbuild] Remove unused usings. * [msbuild] Make ILMerge work when building for netstandard2.0. Also unify/deduplicate the ILMerge logic between Xamarin.iOS and Xamarin.Mac. * [msbuild] Build for netstandard2.0 in addition to net461. * [msbuild] Use custom project configurations to support running the tests for both netstandard2.0 and net461. Use custom project configurations to support running the tests for when the tasks assembly is built for netstandard2.0 and net461. * [tests] Make command-line based 'make test-ios-tasks' run tests for both netstandard2.0 and net461. * [xharness] Add test configuration to run iOS MSBuild tests using either netstandard2.0 or net461. * [msbuild] Make the netstandard2.0-buils task assemblies the default. * [msbuild] ILRepack lib assemblies, not ref assemblies. Ask MSBuild to copy lib assemblies to the output folder when building for netstandard2.0, this way we can easily find the actual implementation libraries to pass to ILRepack. * [msbuild] Merge System.Text.Encodings.Web.dll as well. * [xharness] Fix build of MSBuild tests for iOS.
2020-01-16 20:22:48 +03:00
<MergedAssemblies Include="@(ReferenceCopyLocalPaths)" Condition="'%(Extension)' == '.dll'
And !$([MSBuild]::ValueOrDefault('%(FileName)', '').EndsWith('.resources', StringComparison.OrdinalIgnoreCase))
And !$([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('Microsoft.Build.', StringComparison.OrdinalIgnoreCase))
And !$([MSBuild]::ValueOrDefault('%(FullPath)', '').StartsWith('/Library/Frameworks/Mono.framework', StringComparison.OrdinalIgnoreCase))"
[msbuild] Build the MSBuild task assemblies for netstandard2.0. (#7706) * Bump Xamarin.MacDev. New commits in xamarin/Xamarin.MacDev: * xamarin/Xamarin.MacDev@210c664 Adds net451 to Xamarin.MacDev.csproj * xamarin/Xamarin.MacDev@64db365 [winios] Changes provisioning profiles default path * xamarin/Xamarin.MacDev@d34430a Switch to short-form projects and build for both net461 and netstandard2.0. (#68) Diff: https://github.com/xamarin/Xamarin.MacDev/compare/0f578f51e63b6ff93014782dbc9378e6b6bc6d75..210c664e56117d3a1a7f6dd002109eb444dbdc17 * [msbuild] Update to latest Mono.Cecil. The older version doesn't support netstandard2.0. No code changes were required. * [msbuild] Remove unused usings. * [msbuild] Make ILMerge work when building for netstandard2.0. Also unify/deduplicate the ILMerge logic between Xamarin.iOS and Xamarin.Mac. * [msbuild] Build for netstandard2.0 in addition to net461. * [msbuild] Use custom project configurations to support running the tests for both netstandard2.0 and net461. Use custom project configurations to support running the tests for when the tasks assembly is built for netstandard2.0 and net461. * [tests] Make command-line based 'make test-ios-tasks' run tests for both netstandard2.0 and net461. * [xharness] Add test configuration to run iOS MSBuild tests using either netstandard2.0 or net461. * [msbuild] Make the netstandard2.0-buils task assemblies the default. * [msbuild] ILRepack lib assemblies, not ref assemblies. Ask MSBuild to copy lib assemblies to the output folder when building for netstandard2.0, this way we can easily find the actual implementation libraries to pass to ILRepack. * [msbuild] Merge System.Text.Encodings.Web.dll as well. * [xharness] Fix build of MSBuild tests for iOS.
2020-01-16 20:22:48 +03:00
/>
<MergedAssemblies Include="@(ReferencePath)" Condition="'%(Extension)' == '.dll' And $([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('Mono.Cecil', StringComparison.OrdinalIgnoreCase))" />
[msbuild] Build the MSBuild task assemblies for netstandard2.0. (#7706) * Bump Xamarin.MacDev. New commits in xamarin/Xamarin.MacDev: * xamarin/Xamarin.MacDev@210c664 Adds net451 to Xamarin.MacDev.csproj * xamarin/Xamarin.MacDev@64db365 [winios] Changes provisioning profiles default path * xamarin/Xamarin.MacDev@d34430a Switch to short-form projects and build for both net461 and netstandard2.0. (#68) Diff: https://github.com/xamarin/Xamarin.MacDev/compare/0f578f51e63b6ff93014782dbc9378e6b6bc6d75..210c664e56117d3a1a7f6dd002109eb444dbdc17 * [msbuild] Update to latest Mono.Cecil. The older version doesn't support netstandard2.0. No code changes were required. * [msbuild] Remove unused usings. * [msbuild] Make ILMerge work when building for netstandard2.0. Also unify/deduplicate the ILMerge logic between Xamarin.iOS and Xamarin.Mac. * [msbuild] Build for netstandard2.0 in addition to net461. * [msbuild] Use custom project configurations to support running the tests for both netstandard2.0 and net461. Use custom project configurations to support running the tests for when the tasks assembly is built for netstandard2.0 and net461. * [tests] Make command-line based 'make test-ios-tasks' run tests for both netstandard2.0 and net461. * [xharness] Add test configuration to run iOS MSBuild tests using either netstandard2.0 or net461. * [msbuild] Make the netstandard2.0-buils task assemblies the default. * [msbuild] ILRepack lib assemblies, not ref assemblies. Ask MSBuild to copy lib assemblies to the output folder when building for netstandard2.0, this way we can easily find the actual implementation libraries to pass to ILRepack. * [msbuild] Merge System.Text.Encodings.Web.dll as well. * [xharness] Fix build of MSBuild tests for iOS.
2020-01-16 20:22:48 +03:00
</ItemGroup>
<ItemGroup>
<ReferenceCopyLocalDirs Include="@(ReferenceCopyLocalPaths -&gt; '%(RootDir)%(Directory)')" />
<ReferenceCopyLocalPaths Remove="@(MergedAssemblies)" />
<LibDir Include="@(ReferenceCopyLocalDirs -&gt; Distinct())" />
</ItemGroup>
<PropertyGroup>
<ILRepackArgs Condition="'$(AssemblyOriginatorKeyFile)' != ''">/keyfile:"$(AssemblyOriginatorKeyFile)"</ILRepackArgs>
<ILRepackArgs>$(ILRepackArgs) @(LibDir -&gt; '/lib:"%(Identity)."', ' ')</ILRepackArgs>
<ILRepackArgs>$(ILRepackArgs) /out:"@(IntermediateAssembly -&gt; '%(FullPath)')"</ILRepackArgs>
<ILRepackArgs>$(ILRepackArgs) "@(IntermediateAssembly -&gt; '%(FullPath)')"</ILRepackArgs>
<ILRepackArgs>$(ILRepackArgs) @(MergedAssemblies -&gt; '"%(FullPath)"', ' ')</ILRepackArgs>
<ILRepackArgs>$(ILRepackArgs) "/lib:$(NetstandardDirectory)"</ILRepackArgs> <!-- This is needed for ilrepack to find netstandard.dll, which is referenced by the System.Text.Json assembly -->
</PropertyGroup>
<Exec Command="&quot;$(ILRepack)&quot; $(ILRepackArgs)" WorkingDirectory="$(MSBuildProjectDirectory)\$(OutputPath)" StandardErrorImportance="high" StandardOutputImportance="low" ConsoleToMSBuild="true" ContinueOnError="true">
<Output TaskParameter="ConsoleOutput" PropertyName="ILRepackOutput" />
<Output TaskParameter="ExitCode" PropertyName="ExitCode" />
</Exec>
<Message Importance="high" Text="$(ILRepackOutput)" Condition="'$(ExitCode)' != '0'" />
<Delete Files="$(IntermediateOutputPath)ilrepack.txt" Condition="'$(ExitCode)' != '0'" />
<Touch AlwaysCreate="true" Files="$(IntermediateOutputPath)ilrepack.txt" Condition="'$(ExitCode)' == '0'" />
<Error Text="$(ILRepackOutput)" Condition="'$(ExitCode)' != '0' And '$(ContinueOnError)' != 'true'" />
<Delete Files="@(MergedAssemblies -&gt; '$(MSBuildProjectDirectory)\$(OutputPath)%(Filename)%(Extension)')" Condition="Exists('$(MSBuildProjectDirectory)\$(OutputPath)%(Filename)%(Extension)')" />
</Target>
</Project>