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

Commit

Permalink
Port all managed product binaries to use SDK style projects (#24285)
Browse files Browse the repository at this point in the history
Convert managed product binary to use SDK project system.
 - Uses Arcade for versions strings
 - Overrides Arcade defined output paths - should change in the future
  • Loading branch information
AaronRobinsonMSFT authored May 6, 2019
1 parent 7681c19 commit 099177b
Show file tree
Hide file tree
Showing 26 changed files with 271 additions and 320 deletions.
5 changes: 4 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project>

<!-- Ensure our properties are set before Arcade defines defaults -->
<Import Project="dir.common.props" Condition="'$(ArcadeBuild)' == 'True'" />
<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" Condition="'$(ArcadeBuild)' == 'True'"/>

<PropertyGroup Condition="'$(CopyrightNetFoundation)' != ''">
Expand Down
29 changes: 21 additions & 8 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ set __BuildManagedTools=1
set __RestoreOptData=1
set __GenerateLayout=0
set __CrossgenAltJit=
set __SkipRestoreArg=
set __SkipRestoreArg=/p:RestoreDuringBuild=true
set __OfficialBuildIdArg=
set __CrossArch=
set __SkipNugetPackage=0
Expand Down Expand Up @@ -510,7 +510,7 @@ if %__BuildCrossArchNative% EQU 1 (
/p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true^
/p:UsePartialNGENOptimization=false /maxcpucount^
%__CrossCompIntermediatesDir%\install.vcxproj^
!__Logging! /p:Configuration=%__BuildType% /p:Platform=%__CrossArch% %__CommonMSBuildArgs% /m:2 %__UnprocessedBuildArgs%
!__Logging! /p:Configuration=%__BuildType% /p:Platform=%__CrossArch% %__CommonMSBuildArgs% %__UnprocessedBuildArgs%

if not !errorlevel! == 0 (
echo %__MsgPrefix%Error: cross-arch components build failed. Refer to the build log files for details:
Expand Down Expand Up @@ -597,7 +597,7 @@ if %__BuildNative% EQU 1 (
/l:BinClashLogger,Tools/net46/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log^
/p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true^
/p:UsePartialNGENOptimization=false /maxcpucount %__IntermediatesDir%\install.vcxproj^
!__Logging! /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__CommonMSBuildArgs% /m:2 %__UnprocessedBuildArgs%
!__Logging! /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__CommonMSBuildArgs% %__UnprocessedBuildArgs%

if not !errorlevel! == 0 (
echo %__MsgPrefix%Error: native component build failed. Refer to the build log files for details:
Expand Down Expand Up @@ -652,15 +652,28 @@ if %__BuildCoreLib% EQU 1 (
set __MsbuildErr=/flp2:ErrorsOnly;LogFile=!__BuildErr!
set __Logging=!__MsbuildLog! !__MsbuildWrn! !__MsbuildErr!

call %__ProjectDir%\dotnet.cmd msbuild /nologo /verbosity:minimal /clp:Summary /nodeReuse:false^
call %__ProjectDir%\dotnet.cmd restore /nologo /verbosity:minimal /clp:Summary /nodeReuse:false^
/l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log^
/p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true^
/p:UsePartialNGENOptimization=false /maxcpucount^
%__ProjectDir%\build.proj^
/p:UsePartialNGENOptimization=false /maxcpucount /p:IncludeRestoreOnlyProjects=true /p:ArcadeBuild=true^
%__ProjectDir%\src\build.proj^
!__Logging! %__CommonMSBuildArgs% !__ExtraBuildArgs! %__UnprocessedBuildArgs%
if not !errorlevel! == 0 (
echo %__MsgPrefix%Error: Managed Product assemblies restore failed. Refer to the build log files for details:
echo !__BuildLog!
echo !__BuildWrn!
echo !__BuildErr!
exit /b 1
)

call %__ProjectDir%\dotnet.cmd msbuild /nologo /verbosity:minimal /clp:Summary /nodeReuse:false^
/l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log^
/p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true^
/p:UsePartialNGENOptimization=false /maxcpucount /p:DotNetUseShippingVersions=true /p:ArcadeBuild=true^
%__ProjectDir%\src\build.proj^
!__Logging! %__CommonMSBuildArgs% !__ExtraBuildArgs! %__UnprocessedBuildArgs%
if not !errorlevel! == 0 (
echo %__MsgPrefix%Error: System.Private.CoreLib build failed. Refer to the build log files for details:
echo %__MsgPrefix%Error: Managed Product assemblies build failed. Refer to the build log files for details:
echo !__BuildLog!
echo !__BuildWrn!
echo !__BuildErr!
Expand Down Expand Up @@ -816,7 +829,7 @@ if %__BuildNativeCoreLib% EQU 1 (
set COMPlus_ContinueOnAssert=0
)

set NEXTCMD="%__CrossgenExe%" %__IbcTuning% /Platform_Assemblies_Paths "%__BinDir%"\IL /out "%__BinDir%\System.Private.CoreLib.dll" "%__BinDir%\IL\System.Private.CoreLib.dll"
set NEXTCMD="%__CrossgenExe%" %__IbcTuning% /Platform_Assemblies_Paths "%__BinDir%\IL" /out "%__BinDir%\System.Private.CoreLib.dll" "%__BinDir%\IL\System.Private.CoreLib.dll"
echo %__MsgPrefix%!NEXTCMD!
echo %__MsgPrefix%!NEXTCMD! >> "%__CrossGenCoreLibLog%"
!NEXTCMD! >> "%__CrossGenCoreLibLog%" 2>&1
Expand Down
45 changes: 4 additions & 41 deletions build.proj
Original file line number Diff line number Diff line change
@@ -1,51 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.Build.NoTargets">
<!-- [ARCADE_REMOVE] The entire file can be removed -->
<Import Project="dir.props" />

<ItemGroup>
<!-- We use build.proj instead of dirs.proj so we don't conflict with the TFS build-->
<Project Include="src\build.proj" />
</ItemGroup>

<Import Project="dir.targets" />

<Import Project="dir.traversal.targets" />

<Import Project="$(ToolsDir)clean.targets" />

<!-- The following properties are in place to keep the behavior of build.cmd while we work on the dev workflow steps. -->
<PropertyGroup>
<!-- To disable the restoration of packages, set RestoreDuringBuild=false or pass /p:RestoreDuringBuild=false.-->
<RestoreDuringBuild Condition="'$(RestoreDuringBuild)'==''">true</RestoreDuringBuild>
</PropertyGroup>

<!-- Override clean from dir.traversal.targets and just remove the full BinDir -->
<Target Name="Clean">
<Delete Files="$(BinDir)SOS.NETCore.*" />
<Delete Files="$(BinDir)mscorlib.*" />
<Delete Files="$(BinDir)System.Private.CoreLib.*" />
<Delete Files="$(BinDir)netcoreapp2.0/R2RDump.*" />
</Target>

<!--
BuildTools will conditionally restore additional packages, including IBC tools, using the "RestoreOptionalToolingPackages"
target, which runs automatically before "Sync". Since no "Sync" target actually exists, go ahead and define one now so that
the tools are fetched before "Build".
-->
<Target Name="Sync" BeforeTargets="Build" DependsOnTargets="RestoreOptData;RestoreNETCorePlatforms" />

<Target Name="RestoreOptData" Condition="'$(RestoreDuringBuild)'=='true' and '$(BuildType)'=='Release'">
<Exec Command="$(DotnetRestoreCommand) $(SourceDir).nuget/optdata/optdata.csproj" StandardOutputImportance="Low" />
</Target>

<Target Name="RestoreNETCorePlatforms" Condition="'$(RestoreDuringBuild)'=='true'">
<Exec Command="$(DotnetRestoreCommand) $(SourceDir).nuget/init/init.csproj" StandardOutputImportance="Low" />
</Target>

<Target Name="CleanAllProjects">
<Message Condition="Exists($(RootBinDir))" Importance="High" Text="Removing $(RootBinDir)"/>
<RemoveDir Directories="$(RootBinDir)" />
</Target>

</Project>
<Import Project="$(ToolsDir)clean.targets" />
</Project>
20 changes: 17 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,25 @@ build_CoreLib()
__ExtraBuildArgs="$__ExtraBuildArgs /p:BuildManagedTools=true"
fi

$__ProjectRoot/dotnet.sh restore /nologo /verbosity:minimal /clp:Summary \
/l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll\;LogFile=binclash.log \
/p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true \
/p:UsePartialNGENOptimization=false /maxcpucount /p:IncludeRestoreOnlyProjects=true /p:ArcadeBuild=true\
$__ProjectDir/src/build.proj \
/flp:Verbosity=normal\;LogFile=$__LogsDir/System.Private.CoreLib_$__BuildOS__$__BuildArch__$__BuildType.log \
/p:__IntermediatesDir=$__IntermediatesDir /p:__RootBinDir=$__RootBinDir /p:BuildNugetPackage=false \
$__CommonMSBuildArgs $__ExtraBuildArgs $__UnprocessedBuildArgs

if [ $? -ne 0 ]; then
echo "Failed to restore managed components."
exit 1
fi

$__ProjectRoot/dotnet.sh msbuild /nologo /verbosity:minimal /clp:Summary \
/l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll\;LogFile=binclash.log \
/p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true \
/p:UsePartialNGENOptimization=false /maxcpucount \
$__ProjectDir/build.proj \
/p:UsePartialNGENOptimization=false /maxcpucount /p:DotNetUseShippingVersions=true /p:ArcadeBuild=true\
$__ProjectDir/src/build.proj \
/flp:Verbosity=normal\;LogFile=$__LogsDir/System.Private.CoreLib_$__BuildOS__$__BuildArch__$__BuildType.log \
/p:__IntermediatesDir=$__IntermediatesDir /p:__RootBinDir=$__RootBinDir /p:BuildNugetPackage=false \
$__CommonMSBuildArgs $__ExtraBuildArgs $__UnprocessedBuildArgs
Expand Down Expand Up @@ -656,7 +670,7 @@ __msbuildonunsupportedplatform=0
__PgoOptDataVersion=""
__IbcOptDataVersion=""
__BuildManagedTools=1
__SkipRestoreArg=""
__SkipRestoreArg="/p:RestoreDuringBuild=true"
__SignTypeArg=""
__OfficialBuildIdArg=""
__StaticAnalyzer=0
Expand Down
39 changes: 0 additions & 39 deletions clr.coreclr.props

This file was deleted.

41 changes: 40 additions & 1 deletion clr.defines.targets → clr.featuredefines.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,42 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project>
<PropertyGroup>
<FeatureCollectibleALC>true</FeatureCollectibleALC>
<FeatureEventTrace>true</FeatureEventTrace>
<FeatureHardwareIntrinsics>true</FeatureHardwareIntrinsics>
<FeatureICastable>true</FeatureICastable>
<FeatureManagedEtwChannels>true</FeatureManagedEtwChannels>
<FeatureManagedEtw>true</FeatureManagedEtw>
<FeaturePerfTracing>true</FeaturePerfTracing>
<FeatureTypeEquivalence>true</FeatureTypeEquivalence>
<FeatureBasicFreeze>true</FeatureBasicFreeze>
<FeatureDefaultInterfaces>true</FeatureDefaultInterfaces>
<ProfilingSupportedBuild>true</ProfilingSupportedBuild>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetsUnix)' == 'true'">
<FeaturePal>true</FeaturePal>
<FeatureXplatEventSource>true</FeatureXplatEventSource>

<FeatureArrayStubAsIL>true</FeatureArrayStubAsIL>
<FeatureMulticastStubAsIL>true</FeatureMulticastStubAsIL>
<FeatureStubsAsIL>true</FeatureStubsAsIL>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetsWindows)' == 'true'">
<FeatureArrayStubAsIL Condition="'$(Platform)' != 'x86'">true</FeatureArrayStubAsIL>
<FeatureMulticastStubAsIL Condition="'$(Platform)' != 'x86'">true</FeatureMulticastStubAsIL>
<FeatureStubsAsIL Condition="'$(Platform)' == 'arm64'">true</FeatureStubsAsIL>
<FeatureUseLcid>true</FeatureUseLcid>
<FeatureCominterop>true</FeatureCominterop>
<FeatureClassicCominterop>true</FeatureClassicCominterop>
<FeatureCominteropUnmanagedActivation>true</FeatureCominteropUnmanagedActivation>
<FeatureCominteropWinRTManagedActivation>true</FeatureCominteropWinRTManagedActivation>
<FeatureCominteropApartmentSupport>true</FeatureCominteropApartmentSupport>
<FeatureAppX>true</FeatureAppX>
<FeatureWin32Registry>true</FeatureWin32Registry>
<FeatureProfAttach>true</FeatureProfAttach>
</PropertyGroup>

<!-- Features we're currently flighting, but don't intend to ship in officially supported releases -->
<PropertyGroup Condition="'$(IsPrerelease)' == 'true'">
<FeatureUtf8String>true</FeatureUtf8String>
Expand Down Expand Up @@ -26,6 +64,7 @@
<DefineConstants Condition="'$(FeatureDefaultInterfaces)' == 'true'">$(DefineConstants);FEATURE_DEFAULT_INTERFACES</DefineConstants>
<DefineConstants Condition="'$(FeatureTypeEquivalence)' == 'true'">$(DefineConstants);FEATURE_TYPEEQUIVALENCE</DefineConstants>
<DefineConstants Condition="'$(FeatureBasicFreeze)' == 'true'">$(DefineConstants);FEATURE_BASICFREEZE</DefineConstants>
<DefineConstants Condition="'$(FeatureUtf8String)' == 'true'">$(DefineConstants);FEATURE_UTF8STRING</DefineConstants>

<DefineConstants Condition="'$(ProfilingSupportedBuild)' == 'true'">$(DefineConstants);PROFILING_SUPPORTED</DefineConstants>
<DefineConstants Condition="'$(FeatureProfAttach)' == 'true'">$(DefineConstants);FEATURE_PROFAPI_ATTACH_DETACH</DefineConstants>
Expand Down
5 changes: 3 additions & 2 deletions dir.common.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project>

<!-- This file contains build properties that apply to product
projects and test projects. It's imported by
Expand Down Expand Up @@ -30,11 +30,12 @@

<Configuration Condition="'$(Configuration)' == ''">$(BuildType)</Configuration>
<Platform Condition="'$(Platform)' == ''">$(BuildArch)</Platform>

<PlatformConfigPathPart>$(BuildOS).$(BuildArch).$(BuildType)</PlatformConfigPathPart>
</PropertyGroup>

<PropertyGroup>
<RestorePackagesPath>$(PackagesDir)</RestorePackagesPath>
</PropertyGroup>


</Project>
13 changes: 7 additions & 6 deletions dir.props
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@
<RootBinDir Condition="'$(__RootBinDir)'==''">$(ProjectDir)bin\</RootBinDir>

<BinDir>$(__BinDir)\</BinDir>
<BinDir Condition="'$(__BinDir)'==''">$(RootBinDir)Product\$(BuildOS).$(BuildArch).$(BuildType)\</BinDir>

<__IntermediatesDir Condition="'$(__IntermediatesDir)' == ''">$(RootBinDir)obj\$(BuildOS).$(BuildArch).$(BuildType)</__IntermediatesDir>
<IntermediateOutputRootPath Condition="'$(IntermediateOutputRootPath)' == ''">$(__IntermediatesDir)\</IntermediateOutputRootPath>
<BinDir Condition="'$(__BinDir)'==''">$(RootBinDir)Product\$(PlatformConfigPathPart)\</BinDir>

<!-- We don't append back slash because this path is used by nuget.exe as output directory and it
fails to write packages to it if the path contains the forward slash.
Expand All @@ -78,7 +75,7 @@
<BuildToolsSemaphore Condition="'$(BuildToolsSemaphore)' == ''">$(ToolsDir)Microsoft.DotNet.Build.Tasks.dll</BuildToolsSemaphore>

<TestWorkingDir>$(__TestWorkingDir)\</TestWorkingDir>
<TestWorkingDir Condition="'$(__TestWorkingDir)'==''">$(RootBinDir)tests\$(BuildOS).$(BuildArch).$(BuildType)\</TestWorkingDir>
<TestWorkingDir Condition="'$(__TestWorkingDir)'==''">$(RootBinDir)tests\$(PlatformConfigPathPart)\</TestWorkingDir>

<Platform Condition="'$(Platform)' == ''">$(BuildArch)</Platform>
<Platform Condition="'$(Platform)' == 'amd64'">x64</Platform>
Expand All @@ -92,7 +89,11 @@
<!-- Output paths -->
<PropertyGroup>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)' == ''">$(RootBinDir)obj\</BaseIntermediateOutputPath>
<IntermediateOutputPath Condition="'$(IntermediateOutputPath)' == ''">$(BaseIntermediateOutputPath)$(BuildOS).$(BuildArch).$(BuildType)\$(MSBuildProjectName)</IntermediateOutputPath>

<AppendTargetFrameworkToOutputPath Condition="'$(ArcadeBuild)' == 'true'">false</AppendTargetFrameworkToOutputPath>
<IntermediateOutputPath>$(__IntermediatesDir)\$(MSBuildProjectName)\</IntermediateOutputPath>
<IntermediateOutputPath Condition="'$(__IntermediatesDir)' == ''">$(RootBinDir)obj/$(PlatformConfigPathPart)/$(MSBuildProjectName)/</IntermediateOutputPath>

<OutputPath Condition="'$(OutputPath)' == ''">$(BinDir)</OutputPath>
</PropertyGroup>

Expand Down
4 changes: 3 additions & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19229.8",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19229.8"
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19229.8",
"Microsoft.Build.NoTargets": "1.0.53",
"Microsoft.Build.Traversal": "1.0.52"
}
}
6 changes: 4 additions & 2 deletions pgosupport.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ function(add_pgo TargetName)
endif(WIN32)
elseif(CLR_CMAKE_PGO_OPTIMIZE)
# If we don't have profile data availble, gracefully fall back to a non-PGO opt build
if(EXISTS ${ProfilePath})
if(NOT EXISTS ${ProfilePath})
message("PGO data file NOT found: ${ProfilePath}")
else(NOT EXISTS ${ProfilePath})
if(WIN32)
set_property(TARGET ${TargetName} APPEND_STRING PROPERTY LINK_FLAGS_RELEASE " /LTCG /USEPROFILE:PGD=${ProfilePath}")
set_property(TARGET ${TargetName} APPEND_STRING PROPERTY LINK_FLAGS_RELWITHDEBINFO " /LTCG /USEPROFILE:PGD=${ProfilePath}")
Expand All @@ -46,6 +48,6 @@ function(add_pgo TargetName)
endif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6)
endif(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL RELEASE OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL RELWITHDEBINFO)
endif(WIN32)
endif(EXISTS ${ProfilePath})
endif(NOT EXISTS ${ProfilePath})
endif(CLR_CMAKE_PGO_INSTRUMENT)
endfunction(add_pgo)
2 changes: 1 addition & 1 deletion src/.nuget/optdata/ibcmerge.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />

<PropertyGroup>
<TargetFramework>netstandard</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<RuntimeIdentifiers>win7-x64;win7-x86;linux-x64</RuntimeIdentifiers>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/.nuget/optdata/optdata.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />

<PropertyGroup>
<TargetFramework>netstandard</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<RuntimeIdentifiers>win7-x64;win7-x86;linux-x64</RuntimeIdentifiers>
</PropertyGroup>
Expand Down
9 changes: 9 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project>
<Import Project="../Directory.Build.props" />

<!-- Properties that should be defined for all managed product assemblies -->
<PropertyGroup>
<Company>Microsoft Corporation</Company>
<Product>Microsoft%AE .NET Core</Product>
</PropertyGroup>
</Project>
Loading

0 comments on commit 099177b

Please sign in to comment.