Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Fix BuildAllConfigurations #15754

Merged
merged 18 commits into from
Feb 3, 2017
Merged
Show file tree
Hide file tree
Changes from 2 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
27 changes: 20 additions & 7 deletions Tools-Override/depProj.targets
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,31 @@ See the LICENSE file in the project root for more information.
<Target Name="CreateManifestResourceNames" />

<!-- Support filtering to a subset of packages -->
<Target Name="FilterNugetPackages" AfterTargets="ResolveNuGetPackages">
<Target Name="FilterNugetPackages"
AfterTargets="ResolveNuGetPackages"
Condition="'@(PackageToInclude)' != '' OR '@(PackageToExclude)' != '' OR '@(FileToInclude)' != '' OR '@(FileToExclude)' != ''">
<ItemGroup>
<_referenceCopyLocalByPackageId Include="@(ReferenceCopyLocalPaths->'%(NuGetPackageId)')">
<_nuGetDeploy Include="@($(NuGetDeploySourceItem))"/>
<_nuGetDeployByFileName Include="@(_nuGetDeploy->'%(FileName)')">
<OriginalItemSpec>%(Identity)</OriginalItemSpec>
</_referenceCopyLocalByPackageId>
</_nuGetDeployByFileName>

<_referenceCopyLocalByPackageIdToRemove Include="@(_referenceCopyLocalByPackageId)" Exclude="@(PackageToInclude)" Condition="'@(PackageToInclude)' != ''" />
<_filteredReferenceCopyLocalByPackageId Include="@(_referenceCopyLocalByPackageId)" Exclude="@(_referenceCopyLocalByPackageIdToRemove);@(PackageToExclude)" />
<_nuGetDeployByFileNameToRemove Include="@(_nuGetDeployByFileName)" Exclude="@(FileToInclude)" Condition="'@(FileToInclude)' != ''" />
<_filteredNuGetDeployByFileName Include="@(_nuGetDeployByFileName)" Exclude="@(_nuGetDeployByFileNameToRemove);@(FileToExclude)" />

<_nuGetDeployByPackageId Include="@(_filteredNuGetDeployByFileName->'%(NuGetPackageId)')" />

<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)"/>
<ReferenceCopyLocalPaths Include="@(_filteredReferenceCopyLocalByPackageId->'%(OriginalItemSpec)')" />
<_nuGetDeployByPackageIdToRemove Include="@(_nuGetDeployByPackageId)" Exclude="@(PackageToInclude)" Condition="'@(PackageToInclude)' != ''" />
<_filteredNuGetDeployByPackageId Include="@(_nuGetDeployByPackageId)" Exclude="@(_nuGetDeployByPackageIdToRemove);@(PackageToExclude)" />

<ReferenceCopyLocalPaths Condition="'$(NuGetDeploySourceItem)' == 'ReferenceCopyLocalPaths'" Remove="@(ReferenceCopyLocalPaths)" />
<Reference Condition="'$(NuGetDeploySourceItem)' == 'Reference'" Remove="@(Reference)" />
<Analyzer Condition="'$(NuGetDeploySourceItem)' == 'Analyzer'" Remove="@(Analyzer)" />
</ItemGroup>

<CreateItem Include="@(_filteredNuGetDeployByPackageId->'%(OriginalItemSpec)')">
<Output TaskParameter="Include" ItemName="$(NuGetDeploySourceItem)" />
</CreateItem>
</Target>

</Project>
6 changes: 3 additions & 3 deletions binplace.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project ToolsVersion="14.0" InitialTargets="CheckForBuildTools" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<IsRuntimeAssembly Condition="'$(IsRuntimeAssembly)'=='' AND '$(IsReferenceAssembly)' != 'true' AND '$(IsTestProject)' != 'true'">true</IsRuntimeAssembly>
<IsRuntimeAssembly Condition="'$(IsRuntimeAssembly)'=='' AND '$(IsReferenceAssembly)' != 'true' AND '$(BinPlaceRef)' != 'true' AND '$(IsTestProject)' != 'true'">true</IsRuntimeAssembly>
Copy link
Member

Choose a reason for hiding this comment

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

Why does BinPlaceRef != true equate to not a runtime assembly? I thought we do have some cases where it would be a runtime assembly that we bin place into ref.

Copy link
Member Author

Choose a reason for hiding this comment

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

See below. We're only here if a project only declared BinPlaceRef (and not BinPlaceRuntime). This doesn't break anything, it allows for projects to opt in to only ref without getting side effects of claiming to be IsReferenceAssembly.

<!-- Try to determine if this is a simple library without a ref project.
https://github.com/dotnet/corefx/issues/14291 is tracking cleaning this up -->
<IsRuntimeAndReferenceAssembly Condition="'$(IsRuntimeAndReferenceAssembly)' == '' and '$(IsRuntimeAssembly)' == 'true' and Exists('$(SourceDir)/$(AssemblyName)') and !Exists('$(SourceDir)/$(AssemblyName)/ref') and !$(AssemblyName.StartsWith('System.Private'))">true</IsRuntimeAndReferenceAssembly>
Expand All @@ -11,8 +11,8 @@
<BuildingDesktopFacade Condition="'$(IsDesktopFacade)' == 'true' And ('$(TargetGroup)' == 'netfx' Or $(TargetGroup.StartsWith('net4')))" >true</BuildingDesktopFacade>

<!-- if building desktop facade, we don't bin place the refs -->
<BinPlaceRef Condition="'$(BuildingDesktopFacade)' != 'true' And ('$(IsReferenceAssembly)' == 'true' OR '$(IsRuntimeAndReferenceAssembly)' == 'true')">true</BinPlaceRef>
<BinPlaceRuntime Condition="'$(IsRuntimeAssembly)' == 'true' OR '$(IsRuntimeAndReferenceAssembly)' == 'true'">true</BinPlaceRuntime>
<BinPlaceRef Condition="'$(BinPlaceRef)' == '' And '$(BuildingDesktopFacade)' != 'true' And ('$(IsReferenceAssembly)' == 'true' OR '$(IsRuntimeAndReferenceAssembly)' == 'true')">true</BinPlaceRef>
<BinPlaceRuntime Condition="'$(BinPlaceRuntime)' == '' And ('$(IsRuntimeAssembly)' == 'true' OR '$(IsRuntimeAndReferenceAssembly)' == 'true')">true</BinPlaceRuntime>

<!-- if building desktop facade and bin placing the runtime, then we need to bin place the refs too -->
<BinPlaceRef Condition="'$(BuildingDesktopFacade)' == 'true' And '$(BinPlaceRuntime)' == 'true'">true</BinPlaceRef>
Expand Down
3 changes: 3 additions & 0 deletions external/dir.targets
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,7 @@
<Target Name="GetTargetPath"
DependsOnTargets="Compile;GetBinplaceItems"
Returns="@(BinplaceItem)" />

<!-- Don't do any filtering of Targeting pack packages -->
<Target Name="FilterTargetingPackResolvedNugetPackages" />
Copy link
Member

Choose a reason for hiding this comment

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

Should we put this in the depproj.targets file?

Copy link
Member Author

Choose a reason for hiding this comment

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

We can in a follow up.

</Project>
26 changes: 4 additions & 22 deletions external/netfx/netfx.depproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<IsReferenceAssembly>true</IsReferenceAssembly>
<BinPlaceRef>true</BinPlaceRef>
Copy link
Member

Choose a reason for hiding this comment

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

Note this change will conflict with my PR #15747. We need to make sure one of us gets this in correctly.

Copy link
Member Author

Choose a reason for hiding this comment

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

This doesn't actually conflict. IsReferenceAssembly still works, but it triggers the "OmitTransitiveCompileReferences" behavior which was trimming out all of NETStandard.Library. For the TargetingPack packages they are flat so they wouldn't hit this. We should try to be consistent about how we specify this, but that can be cleanup, not conflict.

Copy link
Member

Choose a reason for hiding this comment

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

Yep I'm cleaning that up with my current PR.

<NuGetDeploySourceItem>Reference</NuGetDeploySourceItem>
<NugetRuntimeIdentifier>None</NugetRuntimeIdentifier>
</PropertyGroup>
Expand All @@ -21,27 +21,9 @@
<RefPath Condition="'$(ForShims)' != 'true'">$(RefPath)</RefPath>
<RefPath Condition="'$(ForShims)' == 'true'">$(NetFxRefPath)</RefPath>
</BinplaceConfiguration>
</ItemGroup>

<!-- Filter the targeting pack to just these assemblies which we need netcoreapp shims for -->
<ItemGroup>
<TargetingPackReference Include="mscorlib" />
<TargetingPackReference Include="System" />
<TargetingPackReference Include="System.Core" />
<TargetingPackReference Include="System.Drawing" />
<TargetingPackReference Include="System.Numerics" />
<TargetingPackReference Include="System.Runtime.Serialization" />
<TargetingPackReference Include="System.Web" />
<TargetingPackReference Include="System.Xml" />
<TargetingPackReference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup Condition="'$(ForShims)' != 'true'">
<TargetingPackReference Include="System.ComponentModel.DataAnnotations" />
<TargetingPackReference Include="System.Data" />
<TargetingPackReference Include="System.Security" />
<TargetingPackReference Include="System.ServiceProcess" />
<TargetingPackReference Include="System.Transactions" />
<TargetingPackReference Include="WindowsBase" />

<FileToExclude Include="System.EnterpriseServices.Thunk" />
<FileToExclude Include="System.EnterpriseServices.Wrapper" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
Copy link
Member

Choose a reason for hiding this comment

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

I'm interested in understanding why the filtered approach didn't work still. My expectation is that our builds didn't need the full targeting pack and would likely be able to get away with just a smaller subset.

Copy link
Member Author

Choose a reason for hiding this comment

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

We can filter what goes into netfx. Previously I had a separate filter for netfx/net4* configured projects and shims. This broke because they needed to use the same folder. The shims will always be a smaller subset than the libs we build against so we need filtering in the shims. We can easily add back filtering to the depprojs at will in the future.

</Project>
2 changes: 1 addition & 1 deletion external/netstandard/netstandard.depproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<IsNetFx Condition="$(NuGetTargetMoniker.StartsWith('.NETFramework,'))">true</IsNetFx>
<IsNetFxVertical Condition="'$(_bc_TargetGroup)' == 'netfx' OR $(_bc_TargetGroup.StartsWith('net4'))">true</IsNetFxVertical>
<IsNETStandard1x Condition="$(NuGetTargetMoniker.StartsWith('.NETStandard,Version=v1.'))">true</IsNETStandard1x>
<IsReferenceAssembly>true</IsReferenceAssembly>
<BinPlaceRef>true</BinPlaceRef>
<!-- when building for any NetFx vertical, also place facades in runtime folder -->
<IsRuntimeAndReferenceAssembly Condition="'$(IsNetFx)' == 'true' AND '$(IsNetFxVertical)' == 'true'">true</IsRuntimeAndReferenceAssembly>
<NuGetDeploySourceItem>Reference</NuGetDeploySourceItem>
Expand Down
3 changes: 1 addition & 2 deletions external/portable/portable.depproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<IsReferenceAssembly>true</IsReferenceAssembly>
<BinPlaceRef>true</BinPlaceRef>
<NuGetDeploySourceItem>Reference</NuGetDeploySourceItem>
<NugetRuntimeIdentifier>None</NugetRuntimeIdentifier>
</PropertyGroup>
Expand All @@ -13,5 +13,4 @@
</BinplaceConfiguration>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<Target Name="FilterTargetingPackResolvedNugetPackages" />
</Project>
8 changes: 0 additions & 8 deletions external/runtime/runtime.depproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,5 @@
<ProjectJsonTemplate>$(MSBuildThisFileDirectory)NETNative/project.json.template</ProjectJsonTemplate>
<NuGetDeploySourceItem>Reference</NuGetDeploySourceItem>
</PropertyGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'uapaot'">
<TargetingPackReference Include="System.Private.CoreLib" />
<TargetingPackReference Include="System.Private.CoreLib.Augments" />
<TargetingPackReference Include="System.Private.CoreLib.DynamicDelegate" />
<TargetingPackReference Include="System.Private.CoreLib.WinRTInterop" />
<TargetingPackReference Include="System.Private.Interop" />
<TargetingPackReference Include="System.Private.Threading" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
21 changes: 17 additions & 4 deletions src/shims/shims.proj
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,23 @@
<NetCoreAppRefPath>$(RefPath)</NetCoreAppRefPath>
</PropertyGroup>

<ItemGroup>
<NetFxReference Include="mscorlib" />
<NetFxReference Include="System" />
<NetFxReference Include="System.Core" />
<NetFxReference Include="System.Drawing" />
<NetFxReference Include="System.Numerics" />
<NetFxReference Include="System.Runtime.Serialization" />
<NetFxReference Include="System.Web" />
<NetFxReference Include="System.Xml" />
<NetFxReference Include="System.Xml.Linq" />
</ItemGroup>

<Target Name="GetGenFacadesInputs">
<ItemGroup>
<GenFacadesContracts Include="$(NetFxRefPath)*.dll" />
<GenFacadesContracts Include="$(NetStandardRefPath)netstandard.dll" />
<NetFxContracts Include="@(NetFxReference->'$(NetFxRefPath)%(Identity).dll')" />
<NETStandardContracts Include="$(NetStandardRefPath)netstandard.dll" />
<GenFacadesContracts Include="@(NetFxContracts);@(NETStandardContracts)" />
<GenFacadesSeeds Include="$(NetCoreAppRefPath)*.dll" Exclude="$(NetCoreAppRefPath)System.Private.CoreLib.dll" />
</ItemGroup>
</Target>
Expand Down Expand Up @@ -51,9 +64,9 @@
<GenFacadesCmd>$(ToolHostCmd) "$(ToolsDir)GenFacades.exe"</GenFacadesCmd>
</PropertyGroup>

<Exec Command="$(GenFacadesCmd) -contracts:&quot;$(NetFxRefPath)&quot; @&quot;$(GenFacadesResponseFile)&quot;" WorkingDirectory="$(ToolRuntimePath)" />
<Exec Command="$(GenFacadesCmd) -contracts:&quot;@(NetFxContracts)&quot; @&quot;$(GenFacadesResponseFile)&quot;" WorkingDirectory="$(ToolRuntimePath)" />

<Exec Command="$(GenFacadesCmd) -contracts:$(NetStandardRefPath)netstandard.dll @&quot;$(GenFacadesResponseFile)&quot;" WorkingDirectory="$(ToolRuntimePath)" />
<Exec Command="$(GenFacadesCmd) -contracts:&quot;@(NETStandardContracts)&quot; @&quot;$(GenFacadesResponseFile)&quot;" WorkingDirectory="$(ToolRuntimePath)" />

<!-- Copy the facades to the package ref and lib folders to be included in the packages -->
<!-- TODO: replace with BinPlacing targets -->
Expand Down