Skip to content

Commit

Permalink
Remove multi-targeting from runtime.depproj (dotnet#41666)
Browse files Browse the repository at this point in the history
* Remove multi-targeting from runtime.depproj

and convert it to a csproj and use the NoBuild msbuild sdk. Simplify the
project logic in relation to IL vs native code as well.
  • Loading branch information
ViktorHofer authored Sep 7, 2020
1 parent a3a7e0d commit 5f56a50
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 265 deletions.
5 changes: 0 additions & 5 deletions eng/depProj.common.targets

This file was deleted.

156 changes: 0 additions & 156 deletions eng/depProj.targets

This file was deleted.

9 changes: 3 additions & 6 deletions eng/restore/repoRestore.targets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project InitialTargets="_ClearResolvePackageAssets" TreatAsLocalProperty="ExcludeRestorePackageImports">
<PropertyGroup>
<!-- Disable restoring of package references in our projects -->
<RestoreProjectStyle Condition="'$(MSBuildProjectExtension)' != '.depproj'">Unknown</RestoreProjectStyle>
<RestoreProjectStyle>Unknown</RestoreProjectStyle>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -21,12 +21,9 @@
Hack workaround for not restoring each project. Instead, we turn off all the targets
that require a `project.assets.json`, since ours will be empty anyway.
-->
<Target Name="_ClearResolvePackageAssets"
Condition="'$(MSBuildProjectExtension)' != '.depproj'">

<Target Name="_ClearResolvePackageAssets">
<PropertyGroup>
<ResolvePackageDependenciesForBuildDependsOn></ResolvePackageDependenciesForBuildDependsOn>
<ResolvePackageDependenciesForBuildDependsOn />
</PropertyGroup>

</Target>
</Project>
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.20431.4",
"Microsoft.FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0",
"Microsoft.NET.Sdk.IL": "5.0.0-preview.8.20359.4",
"Microsoft.Build.NoTargets": "1.0.53",
"Microsoft.Build.Traversal": "2.0.52"
"Microsoft.Build.NoTargets": "2.0.1",
"Microsoft.Build.Traversal": "2.1.1"
}
}
3 changes: 1 addition & 2 deletions src/libraries/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<BeforeTargetFrameworkInferenceTargets>$(RepositoryEngineeringDir)BeforeTargetFrameworkInference.targets</BeforeTargetFrameworkInferenceTargets>
<IsSourceProject>$([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectDirectory), 'src%24'))</IsSourceProject>
<IsReferenceAssembly Condition="'$(IsReferenceAssembly)' == '' and ($(MSBuildProjectFullPath.Contains('\ref\')) or $(MSBuildProjectFullPath.Contains('/ref/')))">true</IsReferenceAssembly>
<LanguageTargets Condition="'$(MSBuildProjectExtension)' == '.depproj'">$(RepositoryEngineeringDir)depProj.common.targets</LanguageTargets>
<RuntimeGraph>$(LibrariesProjectRoot)OSGroups.json</RuntimeGraph>
<ShouldUnsetParentConfigurationAndPlatform>false</ShouldUnsetParentConfigurationAndPlatform>
<!-- Remove once is fixed: https://github.com/dotnet/roslyn/issues/42344 -->
Expand Down Expand Up @@ -284,7 +283,7 @@
<Import Project="$(RepositoryEngineeringDir)referenceAssemblies.props" Condition="'$(IsReferenceAssembly)' == 'true'" />

<PropertyGroup>
<DisableProjectRestore Condition="'$(MSBuildProjectExtension)' == '.depproj' or '$(MSBuildProjectExtension)' == '.pkgproj'">true</DisableProjectRestore>
<DisableProjectRestore Condition="'$(MSBuildProjectExtension)' == '.pkgproj'">true</DisableProjectRestore>
</PropertyGroup>

<Import Project="$(RepositoryEngineeringDir)restore\repoRestore.props" Condition="'$(DisableProjectRestore)' == 'true'" />
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@

<!-- The Default behavior in VS is to show files for the first target framework in TargetFrameworks property.
This is required to show all the files corresponding to all target frameworks in VS. -->
<ItemGroup>
<ItemGroup Condition="'$(BuildingInsideVisualStudio)' == 'true' or '$(DesignTimeBuild)' == 'true'">
<None Include="$(MSBuildProjectDirectory)\**\*.cs"
Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder);@(Compile)" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,47 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<!-- Set the RuntimeIdentifier so that the DotNetHost and DotNetHostPolicy packages resolve for the corresponding runtime. -->
<RuntimeIdentifier>$(PackageRID)</RuntimeIdentifier>
<NoWarn>$(NoWarn);NU1603;NU1605</NoWarn>
<SwapNativeForIL Condition="'$(SwapNativeForIL)' == '' and ('$(Configuration)' == 'Debug' or '$(Coverage)' == 'true') and '$(RuntimeFlavor)' != 'Mono'">true</SwapNativeForIL>
<TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
<!-- Binplace properties -->
<BinPlaceForTargetVertical>false</BinPlaceForTargetVertical>
<BinPlaceNative>true</BinPlaceNative>
<BinPlaceRuntime>false</BinPlaceRuntime>
<TargetFrameworks>$(NetCoreAppCurrent)-Windows_NT;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser</TargetFrameworks>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>

<ItemGroup Condition="'$(DotNetBuildFromSource)' != 'true'">
<PackageReference Include="Microsoft.DiaSymReader.Native" Version="1.7.0" />
<PackageReference Include="Microsoft.DiaSymReader.Native"
Version="$(MicrosoftDiaSymReaderNativeVersion)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetsMobile)' != 'true'">
<PackageReference Include="Microsoft.NETCore.DotNetHost" Version="$(MicrosoftNETCoreDotNetHostVersion)" />
<PackageReference Include="Microsoft.NETCore.DotNetHostPolicy" Version="$(MicrosoftNETCoreDotNetHostPolicyVersion)" />
<!-- We do not need apphost.exe and the 3.0 SDK will actually remove it.
Exclude here so that when building with the 2.x SDK we don't place it in the test shared framework.
This can be removed once we have a new SDK -->
<FileToExclude Include="apphost" />
<PackageReference Include="Microsoft.NETCore.DotNetHost"
Version="$(MicrosoftNETCoreDotNetHostVersion)" />
<PackageReference Include="Microsoft.NETCore.DotNetHostPolicy"
Version="$(MicrosoftNETCoreDotNetHostPolicyVersion)" />
</ItemGroup>

<!-- Setup the testing shared framework host -->
<Target Name="SetupTestingHost"
Condition="'$(BinPlaceTestSharedFramework)' == 'true'"
AfterTargets="AfterResolveReferences">
<PropertyGroup>
<HostFxrFileName Condition="'$(TargetsWindows)' == 'true'">hostfxr</HostFxrFileName>
<HostFxrFileName Condition="'$(TargetsWindows)' != 'true'">libhostfxr</HostFxrFileName>
<HostPolicyFileName Condition="'$(TargetsWindows)' == 'true'">hostpolicy</HostPolicyFileName>
<HostPolicyFileName Condition="'$(TargetsWindows)' != 'true'">libhostpolicy</HostPolicyFileName>

<UseHardlink>true</UseHardlink>
<!-- workaround core-setup problem for hardlinking dotnet executable to testhost: core-setup #4742 -->
<UseHardlink Condition="'$(_runtimeOSFamily)' == 'FreeBSD'">false</UseHardlink>
</PropertyGroup>

<!-- We do not need apphost.exe.
Exclude here so that when building with the 2.x SDK we don't place it in the test shared framework. -->
<ItemGroup>
<HostFxFile Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Filename)' == '$(HostFxrFileName)'" />
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="'%(Filename)' == 'apphost'" />
</ItemGroup>

<ItemGroup>
<HostFxFile Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Filename)' == 'hostfxr' or
'%(ReferenceCopyLocalPaths.Filename)' == 'libhostfxr'" />
<DotnetExe Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Filename)' == 'dotnet'" />
</ItemGroup>

Expand All @@ -57,19 +60,26 @@

<Target Name="OverrideRuntimeCoreCLR"
DependsOnTargets="ResolveRuntimeFilesFromLocalBuild"
AfterTargets="AfterResolveReferences;FilterNugetPackages"
AfterTargets="AfterResolveReferences"
Condition="'$(RuntimeFlavor)' != 'Mono'">
<ItemGroup>
<!-- CoreRun is not used for testing anymore, but we still use it for benchmarking and profiling -->
<RuntimeFiles Include="$(CoreCLRArtifactsPath)/corerun*" />
<RuntimeFiles Include="$(CoreCLRArtifactsPath)/PDB/corerun*" />
<RuntimeFiles Include="$(CoreCLRArtifactsPath)\corerun*" />
<RuntimeFiles Include="$(CoreCLRArtifactsPath)\PDB\corerun*" />
<ReferenceCopyLocalPaths Include="@(RuntimeFiles)" />
</ItemGroup>
<ItemGroup Condition="'$(SwapNativeForIL)' == 'true'">
<CoreCLRILFiles Include="$(CoreCLRArtifactsPath)\IL\*.*" />
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="'@(CoreCLRILFiles->'%(FileName)%(Extension)')' == '%(FileName)%(Extension)'" />
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="'@(CoreCLRILFiles->'%(FileName).ni%(Extension)')' == '%(FileName)%(Extension)'" />
<ReferenceCopyLocalPaths Include="@(CoreCLRILFiles)" />
</ItemGroup>
<Error Condition="'$(SwapNativeForIL)' == 'true' and '@(CoreCLRILFiles)' == ''" Text="Could not locate CoreCLR IL files." />
</Target>

<Target Name="OverrideRuntimeMono"
DependsOnTargets="ResolveRuntimeFilesFromLocalBuild"
AfterTargets="AfterResolveReferences;FilterNugetPackages"
AfterTargets="AfterResolveReferences"
Condition="'$(RuntimeFlavor)' == 'Mono'">
<ItemGroup>
<ReferenceCopyLocalPaths Include="@(RuntimeFiles)" />
Expand All @@ -80,30 +90,4 @@
DestinationSubDirectory="include/%(RecursiveDir)" />
</ItemGroup>
</Target>

<Target Name="GetCoreCLRILFiles" DependsOnTargets="ResolveRuntimeFilesFromLocalBuild">
<ItemGroup>
<CoreCLRILFiles Include="$(CoreCLRArtifactsPath)/IL/*.*" />
</ItemGroup>
<Error Condition="'@(CoreCLRILFiles)' == ''" Text="Could not locate CoreCLR IL files." />
</Target>

<Target Name="SwapNativeForIL"
AfterTargets="AfterResolveReferences"
DependsOnTargets="GetCoreCLRILFiles;OverrideRuntimeCoreCLR"
Condition="'$(SwapNativeForIL)' == 'true'">
<ItemGroup>
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="'@(CoreCLRILFiles->'%(FileName)%(Extension)')' == '%(FileName)%(Extension)'" />
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="'@(CoreCLRILFiles->'%(FileName).ni%(Extension)')' == '%(FileName)%(Extension)'" />
<ReferenceCopyLocalPaths Include="@(CoreCLRILFiles)" />
</ItemGroup>
</Target>

<!-- Strip away placeholder tfms and TargetFrameworkSuffix. -->
<Target Name="StripTargetFrameworkSuffixFromTargetFrameworks"
BeforeTargets="_GetRestoreTargetFrameworksOutput;_GetRestoreTargetFrameworksAsItems">
<PropertyGroup>
<TargetFrameworks Condition="'$(TargetFrameworks)' != ''">$([System.Text.RegularExpressions.Regex]::Replace('$(TargetFrameworks)', '-[^;]+', ''))</TargetFrameworks>
</PropertyGroup>
</Target>
</Project>
Loading

0 comments on commit 5f56a50

Please sign in to comment.