Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename cross-targeting to multi-targeting #1471

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion build/NuGetPackages/Microsoft.Build.Runtime.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@
-->
<file src="$configuration$\Output\MSBuild.exe" target="contentFiles\any\net46\" />
<file src="$configuration$\Output\MSBuild.exe.config" target="contentFiles\any\net46\" />
<file src="$configuration$\Output\Microsoft.Common.MultiTargeting.targets" target="contentFiles\any\net46\" />
<file src="$configuration$\Output\Microsoft.Common.CrossTargeting.targets" target="contentFiles\any\net46\" />
<file src="$configuration$\Output\Microsoft.Common.CurrentVersion.targets" target="contentFiles\any\net46\" />
<file src="$configuration$\Output\Microsoft.Common.overridetasks" target="contentFiles\any\net46\" />
<file src="$configuration$\Output\Microsoft.Common.props" target="contentFiles\any\net46\$targetMSBuildToolsVersion$\" />
<file src="$configuration$\Output\Microsoft.Common.targets" target="contentFiles\any\net46\" />
<file src="$configuration$\Output\Microsoft.Common.tasks" target="contentFiles\any\net46\" />
<file src="$configuration$\Output\Microsoft.CSharp.MultiTargeting.targets" target="contentFiles\any\net46\" />
<file src="$configuration$\Output\Microsoft.CSharp.CrossTargeting.targets" target="contentFiles\any\net46\" />
<file src="$configuration$\Output\Microsoft.CSharp.CurrentVersion.targets" target="contentFiles\any\net46\" />
<file src="$configuration$\Output\Microsoft.CSharp.targets" target="contentFiles\any\net46\" />
Expand All @@ -52,6 +54,7 @@
<file src="$configuration$\Output\Microsoft.NETFramework.props" target="contentFiles\any\net46\" />
<file src="$configuration$\Output\Microsoft.NETFramework.targets" target="contentFiles\any\net46\" />
<file src="$configuration$\Output\Microsoft.ServiceModel.targets" target="contentFiles\any\net46\" />
<file src="$configuration$\Output\Microsoft.VisualBasic.MultiTargeting.targets" target="contentFiles\any\net46\" />
<file src="$configuration$\Output\Microsoft.VisualBasic.CrossTargeting.targets" target="contentFiles\any\net46\" />
<file src="$configuration$\Output\Microsoft.VisualBasic.CurrentVersion.targets" target="contentFiles\any\net46\" />
<file src="$configuration$\Output\Microsoft.VisualBasic.targets" target="contentFiles\any\net46\" />
Expand Down Expand Up @@ -89,4 +92,4 @@
<file src="$configuration$-NetCore\Output\Microsoft.VisualStudioVersion.v12.Common.props" target="contentFiles\any\netcoreapp1.0\" />
<file src="$configuration$-NetCore\Output\Microsoft.VisualStudioVersion.v14.Common.props" target="contentFiles\any\netcoreapp1.0\" />
</files>
</package>
</package>
6 changes: 6 additions & 0 deletions setup/files.swr
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,21 @@ folder InstallDir:\MSBuild\15.0\Bin
file source=$(X86BinPath)System.Threading.Tasks.Dataflow.dll vs.file.ngen=yes
file source=$(X86BinPath)System.Collections.Immutable.dll vs.file.ngen=yes
file source=$(X86BinPath)Microsoft.Common.CurrentVersion.targets
file source=$(X86BinPath)Microsoft.Common.MultiTargeting.targets
file source=$(X86BinPath)Microsoft.Common.CrossTargeting.targets
file source=$(X86BinPath)Microsoft.Common.overridetasks
file source=$(X86BinPath)Microsoft.Common.targets
file source=$(X86BinPath)Microsoft.Common.tasks
file source=$(X86BinPath)Microsoft.CSharp.CurrentVersion.targets
file source=$(X86BinPath)Microsoft.CSharp.MultiTargeting.targets
file source=$(X86BinPath)Microsoft.CSharp.CrossTargeting.targets
file source=$(X86BinPath)Microsoft.CSharp.targets
file source=$(X86BinPath)Microsoft.NetFramework.CurrentVersion.props
file source=$(X86BinPath)Microsoft.NetFramework.CurrentVersion.targets
file source=$(X86BinPath)Microsoft.NetFramework.props
file source=$(X86BinPath)Microsoft.NetFramework.targets
file source=$(X86BinPath)Microsoft.VisualBasic.CurrentVersion.targets
file source=$(X86BinPath)Microsoft.VisualBasic.MultiTargeting.targets
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes needs to go in the amd64 folder as well (further down in the file). Use the same file source, just needs to be dropped to amd64.

file source=$(X86BinPath)Microsoft.VisualBasic.CrossTargeting.targets
file source=$(X86BinPath)Microsoft.VisualBasic.targets
file source=$(X86BinPath)MSBuild.rsp
Expand Down Expand Up @@ -150,18 +153,21 @@ folder InstallDir:\MSBuild\15.0\Bin\amd64
file source=$(X86BinPath)System.Threading.Tasks.Dataflow.dll vs.file.ngen=yes
file source=$(X86BinPath)System.Collections.Immutable.dll vs.file.ngen=yes
file source=$(X86BinPath)Microsoft.Common.CurrentVersion.targets
file source=$(X86BinPath)Microsoft.Common.MultiTargeting.targets
file source=$(X86BinPath)Microsoft.Common.CrossTargeting.targets
file source=$(X86BinPath)Microsoft.Common.overridetasks
file source=$(X86BinPath)Microsoft.Common.targets
file source=$(X86BinPath)Microsoft.Common.tasks
file source=$(X86BinPath)Microsoft.CSharp.CurrentVersion.targets
file source=$(X86BinPath)Microsoft.CSharp.MultiTargeting.targets
file source=$(X86BinPath)Microsoft.CSharp.CrossTargeting.targets
file source=$(X86BinPath)Microsoft.CSharp.targets
file source=$(X86BinPath)Microsoft.NetFramework.CurrentVersion.props
file source=$(X86BinPath)Microsoft.NetFramework.CurrentVersion.targets
file source=$(X86BinPath)Microsoft.NetFramework.props
file source=$(X86BinPath)Microsoft.NetFramework.targets
file source=$(X86BinPath)Microsoft.VisualBasic.CurrentVersion.targets
file source=$(X86BinPath)Microsoft.VisualBasic.MultiTargeting.targets
file source=$(X86BinPath)Microsoft.VisualBasic.CrossTargeting.targets
file source=$(X86BinPath)Microsoft.VisualBasic.targets
file source=$(X86BinPath)MSBuild.rsp
Expand Down
20 changes: 16 additions & 4 deletions src/XMakeTasks/Microsoft.Build.Tasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -704,9 +704,6 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType>
</Content>
<Content Include="Microsoft.Common.CrossTargeting.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Microsoft.ServiceModel.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand All @@ -730,6 +727,10 @@
<Content Include="Microsoft.Common.CurrentVersion.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Microsoft.Common.MultiTargeting.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType>
</Content>
<Content Include="Microsoft.Common.CrossTargeting.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType>
Expand All @@ -740,6 +741,9 @@
<Content Include="Microsoft.CSharp.CurrentVersion.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Microsoft.CSharp.MultiTargeting.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Microsoft.CSharp.CrossTargeting.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand All @@ -755,6 +759,9 @@
<Content Include="Microsoft.VisualBasic.CurrentVersion.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Microsoft.VisualBasic.MultiTargeting.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Microsoft.VisualBasic.CrossTargeting.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down Expand Up @@ -846,6 +853,9 @@
<DataFile Include="Microsoft.Common.CrossTargeting.targets">
<SubType>Designer</SubType>
</DataFile>
<DataFile Include="Microsoft.Common.MultiTargeting.targets">
<SubType>Designer</SubType>
</DataFile>
<DataFile Include="Microsoft.NETFramework.targets" />
<DataFile Include="Microsoft.NETFramework.CurrentVersion.targets" />
<DataFile Include="Microsoft.NETFramework.props">
Expand All @@ -857,9 +867,11 @@
<DataFile Include="Microsoft.CSharp.targets" />
<DataFile Include="Microsoft.CSharp.CurrentVersion.targets" />
<DataFile Include="Microsoft.CSharp.CrossTargeting.targets" />
<DataFile Include="Microsoft.CSharp.MultiTargeting.targets" />
<DataFile Include="Microsoft.VisualBasic.targets" />
<DataFile Include="Microsoft.VisualBasic.CurrentVersion.targets" />
<DataFile Include="Microsoft.VisualBasic.CrossTargeting.targets" />
<DataFile Include="Microsoft.VisualBasic.MultiTargeting.targets" />
<CopyFile Include="@(DataFile)">
<DestFolder>$(SuiteBinPath)</DestFolder>
</CopyFile>
Expand Down Expand Up @@ -982,4 +994,4 @@
<None Include="project.json" />
</ItemGroup>
<Import Project="..\dir.targets" />
</Project>
</Project>
12 changes: 2 additions & 10 deletions src/XMakeTasks/Microsoft.CSharp.CrossTargeting.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->

<!-- These targets are deprecated, forward to new targets -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intended as a temporary measure so we can update the SDK gradually? Since we haven't shipped an official release with these targets I hope it'd be ok to just rename them atomically.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!-- Import design time targets for Roslyn Project System. These are only available if Visual Studio is installed. -->
<!-- Import design time targets before the common crosstargeting targets, which import targets from Nuget. -->
<PropertyGroup>
<CSharpDesignTimeTargetsPath Condition="'$(CSharpDesignTimeTargetsPath)'==''">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\Managed\Microsoft.CSharp.DesignTime.targets</CSharpDesignTimeTargetsPath>
</PropertyGroup>
<Import Project="$(CSharpDesignTimeTargetsPath)" Condition="'$(CSharpDesignTimeTargetsPath)' != '' and Exists('$(CSharpDesignTimeTargetsPath)')" />

<Import Project="Microsoft.Common.CrossTargeting.targets" />

<Import Project="Microsoft.CSharp.MultiTargeting.targets" />
</Project>
24 changes: 24 additions & 0 deletions src/XMakeTasks/Microsoft.CSharp.MultiTargeting.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!--
***********************************************************************************************
Microsoft.CSharp.MultiTargeting.targets

WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.

Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!-- Import design time targets for Roslyn Project System. These are only available if Visual Studio is installed. -->
<!-- Import design time targets before the common multitargeting targets, which import targets from Nuget. -->
<PropertyGroup>
<CSharpDesignTimeTargetsPath Condition="'$(CSharpDesignTimeTargetsPath)'==''">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\Managed\Microsoft.CSharp.DesignTime.targets</CSharpDesignTimeTargetsPath>
</PropertyGroup>
<Import Project="$(CSharpDesignTimeTargetsPath)" Condition="'$(CSharpDesignTimeTargetsPath)' != '' and Exists('$(CSharpDesignTimeTargetsPath)')" />

<Import Project="Microsoft.Common.MultiTargeting.targets" />

</Project>
10 changes: 6 additions & 4 deletions src/XMakeTasks/Microsoft.CSharp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ Copyright (C) Microsoft Corporation. All rights reserved.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
We are doing a cross-targeting build if there is no list of target frameworks specified
We are doing a multi-targeting build if there is no list of target frameworks specified
nor is there a current target framework being built individually. In that case, this import is
redirected to Microsoft.CSharp.CrossTargeting.targets.
redirected to Microsoft.CSharp.MultiTargeting.targets.
-->
<PropertyGroup Condition="'$(TargetFrameworks)' != '' and '$(TargetFramework)' == ''">
<IsMultiTargetingBuild>true</IsMultiTargetingBuild>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may need to set both as compat shim as discussed in email,

<!-- back-compat for deprecated IsCrossTargetingBuild property -->
<IsCrossTargetingBuild>true</IsCrossTargetingBuild>
</PropertyGroup>

Expand Down Expand Up @@ -49,9 +51,9 @@ Copyright (C) Microsoft Corporation. All rights reserved.
<CscToolPath Condition="'$(CscToolPath)' == '' and '$(BuildingInsideVisualStudio)' != 'true'">$(MsBuildFrameworkToolsPath)</CscToolPath>
</PropertyGroup>
</When>
<When Condition="'$(IsCrossTargetingBuild)' == 'true'">
<When Condition="'$(IsMultiTargetingBuild)' == 'true'">
<PropertyGroup>
<CSharpTargetsPath>$(MSBuildToolsPath)\Microsoft.CSharp.CrossTargeting.targets</CSharpTargetsPath>
<CSharpTargetsPath>$(MSBuildToolsPath)\Microsoft.CSharp.MultiTargeting.targets</CSharpTargetsPath>
</PropertyGroup>
</When>
<Otherwise>
Expand Down
140 changes: 3 additions & 137 deletions src/XMakeTasks/Microsoft.Common.CrossTargeting.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,141 +10,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ImportByWildcardBeforeMicrosoftCommonCrossTargetingTargets Condition="'$(ImportByWildcardBeforeMicrosoftCommonCrossTargetingTargets)' == ''">true</ImportByWildcardBeforeMicrosoftCommonCrossTargetingTargets>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.CrossTargeting.targets\ImportBefore\*.targets"
Condition="'$(ImportByWildcardBeforeMicrosoftCommonCrossTargetingTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.CrossTargeting.targets\ImportBefore')"/>

<Import Project="$(CustomBeforeMicrosoftCommonCrossTargetingTargets)" Condition="'$(CustomBeforeMicrosoftCommonCrossTargetingTargets)' != '' and Exists('$(CustomBeforeMicrosoftCommonCrossTargetingTargets)')"/>

<!--
============================================================
DispatchToInnerBuilds

Builds this project with /t:$(InnerTarget) /p:TargetFramework=X for each
value X in $(TargetFrameworks)

[IN]
$(TargetFrameworks) - Semicolon delimited list of target frameworks.
$(InnerTargets) - The targets to build for each target framework

[OUT]
@(InnerOutput) - The combined output items of the inner targets across
all target frameworks..
============================================================
-->
<Target Name="DispatchToInnerBuilds" Returns="@(InnerOutput)">
<ItemGroup>
<_TargetFramework Include="$(TargetFrameworks)" />
</ItemGroup>
<MSBuild Projects="$(MSBuildProjectFile)"
Condition="'$(TargetFrameworks)' != '' "
Targets="$(InnerTargets)"
Properties="TargetFramework=%(_TargetFramework.Identity)">
<Output ItemName="InnerOutput" TaskParameter="TargetOutputs" />
</MSBuild>
</Target>

<!--
============================================================
Build

Cross-targeting version of Build.

[IN]
$(TargetFrameworks) - Semicolon delimited list of target frameworks.

$(InnerTargets) - The targets to build for each target framework. Defaults
to 'Build' if unset, but allows override to support
`msbuild /p:InnerTargets=X;Y;Z` which will build X, Y,
and Z targets for each target framework.

[OUT]
@(InnerOutput) - The combined output items of the inner targets across
all builds.
============================================================
-->
<Target Name="Build" DependsOnTargets="_SetBuildInnerTarget;DispatchToInnerBuilds" />

<Target Name="_SetBuildInnerTarget" Returns="@(InnerOutput)">
<PropertyGroup Condition="'$(InnerTargets)' == ''">
<InnerTargets>Build</InnerTargets>
</PropertyGroup>
</Target>


<!--
============================================================
Clean

Cross-targeting version of clean.
============================================================
-->
<Target Name="Clean" DependsOnTargets="_SetCleanInnerTarget;DispatchToInnerBuilds" />
<Target Name="_SetCleanInnerTarget">
<PropertyGroup>
<InnerTargets>Clean</InnerTargets>
</PropertyGroup>
</Target>

<!--
============================================================
Rebuild

Cross-targeting version of rebuild.
============================================================
-->
<Target Name="Rebuild" DependsOnTargets="_SetRebuildInnerTarget;DispatchToInnerBuilds" />
<Target Name="_SetRebuildInnerTarget">
<PropertyGroup>
<InnerTargets>Rebuild</InnerTargets>
</PropertyGroup>
</Target>

<!--
This will import NuGet restore targets, which is a special case separate from the package -> project extension
mechanism below. For obvious reasons, we need restore to work before any package assets are available.

TODO: https://github.com/Microsoft/msbuild/issues/1061: This is now generalized with less coupling to nuget,
but this codepath should remain as a compat shim until NuGet and the CLI use the CrossTargeting imports.
-->
<PropertyGroup>
<ImportByWildcardAfterMicrosoftCommonTargets Condition="'$(ImportByWildcardAfterMicrosoftCommonTargets)' == ''">true</ImportByWildcardAfterMicrosoftCommonTargets>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.targets\ImportAfter\*.NuGet.*.targets"
Condition="'$(ImportByWildcardAfterMicrosoftCommonTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.targets\ImportAfter')"/>

<Import Project="$(CustomAfterMicrosoftCommonCrossTargetingTargets)" Condition="'$(CustomAfterMicrosoftCommonCrossTargetingTargets)' != '' and Exists('$(CustomAfterMicrosoftCommonCrossTargetingTargets)')"/>

<!--
Allow extensions like NuGet restore to work before any package assets are available.
-->
<PropertyGroup>
<ImportByWildcardAfterMicrosoftCommonCrossTargetingTargets Condition="'$(ImportByWildcardAfterMicrosoftCommonCrossTargetingTargets)' == ''">true</ImportByWildcardAfterMicrosoftCommonCrossTargetingTargets>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.CrossTargeting.targets\ImportAfter\*.targets"
Condition="'$(ImportByWildcardAfterMicrosoftCommonCrossTargetingTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.CrossTargeting.targets\ImportAfter')"/>

<!--
Import project extensions which usually come from packages. Package management systems will create a file at:
$(MSBuildProjectExtensionsPath)\$(MSBuildProjectFile).<SomethingUnique>.targets

Each package management system should use a unique moniker to avoid collisions. It is a wild-card iport so the package
management system can write out multiple files but the order of the import is alphabetic because MSBuild sorts the list.

This is the same import that would happen in an inner (non-cross targeting) build. Package management systems are responsible for generating
appropriate conditions based on $(IsCrossTargetingBuild) to pull in only those package targets that are meant to participate in a cross-targeting
build.
-->
<PropertyGroup>
<ImportProjectExtensionTargets Condition="'$(ImportProjectExtensionTargets)' == ''">true</ImportProjectExtensionTargets>
</PropertyGroup>

<Import Project="$(MSBuildProjectExtensionsPath)$(MSBuildProjectFile).*.targets" Condition="'$(ImportProjectExtensionTargets)' == 'true' and exists('$(MSBuildProjectExtensionsPath)')" />

<!-- TODO: https://github.com/Microsoft/msbuild/issues/1062: Remove this temporary hook when possible. -->
<Import Project="$(CoreCrossTargetingTargetsPath)"
Condition="'$(CoreCrossTargetingTargetsPath)' != '' and Exists('$(CoreCrossTargetingTargetsPath)')" />
<!-- These targets are deprecated, forward to new targets -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Microsoft.Common.MultiTargeting.targets" />
</Project>
Loading