Skip to content

Clean build on OSX #17

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

Merged
merged 1 commit into from
Mar 27, 2019
Merged
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
135 changes: 133 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,19 +1,41 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!-- Include global shared properties. -->
<Import Project="dir.common.props" />

<!-- Properties set here will influence/modify the default behavior of the -->
<!-- Arcade sdk. -->
<!-- -->
<!-- Arcade will default to producing an Artifacts dir with the following -->
<!-- layout: : -->
<!-- ./artifacts/$(ProjectName)/$(Arch)/$(Config)/$(TargetFramework) -->
<!-- -->
<!-- This layout will be changed for coreclr to match the native layout: -->
<!-- ./artifacts/$(BuildOs)/$(Arch)/$(Config) -->
<!-- -->
<!-- In order to do this, before we import Arcade we set BaseOutputPath to -->
<!-- include the BuildOs and we unset AppendTargetFrameworkToOutputPath -->
<!-- -->
<!-- ToolSetCommonDirectory: Set a restore location for the sdk's tools -->
<!-- this will be used by package creation -->
<PropertyGroup>
<BaseOutputPath>$(MSBuildThisFileDirectory)/artifacts/bin/$(BuildOS)/</BaseOutputPath>
<BaseOutputPath>$(MSBuildThisFileDirectory)/artifacts/Product/$(BuildOS)/</BaseOutputPath>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)' == ''">$(RootArtifactsDir)obj/$(BuildOS)/$(BuildArch)/$(BuildType)/$(MSBuildProjectName)/</BaseIntermediateOutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<ToolSetCommonDirectory>$(MSBuildThisFileDirectory)artifacts\toolset\Common\</ToolSetCommonDirectory>
</PropertyGroup>

<!-- Arcade SDK import -->
<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" Condition="'$(ArcadeBuild)' == 'True'"/>

<PropertyGroup>
<!-- Need to set ProjectAssetsFile to something so it doesn't get set to the Tools.proj assets file when we import the generated props -->
<!-- Hack: Set ProjectAssetsFile to something so it doesn't get set to -->
<!-- the Tools.proj assets file when we import the generated props -->
<ProjectAssetsFile Condition="'$(ProjectAssetsFile)' == ''">unused</ProjectAssetsFile>
</PropertyGroup>

<!-- Import Microsoft.DotNet.Build.Tasks.Packaging -->
<!-- This is used only for packaging -->
<Import Project="$(ToolSetCommonDirectory)Tools.proj.nuget.g.props" Condition="Exists('$(ToolSetCommonDirectory)Tools.proj.nuget.g.props') and '$(BuildPackages)' == 'true'" />

<PropertyGroup>
Expand All @@ -28,8 +50,117 @@
<PropertyGroup>
<CL_MPCount>$(NumberOfCores)</CL_MPCount>
</PropertyGroup>

<PropertyGroup>
<!-- Enables Strict mode for Roslyn compiler -->
<Features>strict</Features>
</PropertyGroup>

<!-- Global properties. These are set after Arcade to override their -->
<!-- Arcade defaults. -->

<PropertyGroup>
<LangVersion>8.0</LangVersion>
<UseSharedCompilation>true</UseSharedCompilation>
</PropertyGroup>

<!-- Set the kind of PDB to Portable and turn on SourceLink (fetching source from GitHub) -->
<PropertyGroup>
<!-- Arcade will set DebugType to embedded, reset this to portable. -->
<DebugType Condition="'$(DebugType)' == '' or $(DebugType) == 'embedded'">Portable</DebugType>
<UseSourceLink>true</UseSourceLink>
</PropertyGroup>

<PropertyGroup>
<!-- This name is used to create a GIT repository URL https://github.com/dotnet/$(GitHubRepositoryName) used to find source code for debugging -->
<GitHubRepositoryName Condition="'$(GitHubRepositoryName)' == ''">coreclr</GitHubRepositoryName>

<DotnetCliPath Condition="'$(DotnetCliPath)'==''">$(ProjectDir).dotnet\</DotnetCliPath>

<!-- BuildTools dependency -->
<DotnetRestoreCommand Condition="'$(DotnetRestoreCommand)'==''">$(DotnetCliPath)/dotnet restore</DotnetRestoreCommand>
<RunningOnUnix Condition="'$(OS)'!='Windows_NT'">true</RunningOnUnix>

<OverrideToolHost>$(DotnetCliPath)dotnet</OverrideToolHost>
<BuildToolsSemaphore Condition="'$(BuildToolsSemaphore)' == ''">$(ToolsDir)Microsoft.DotNet.Build.Tasks.dll</BuildToolsSemaphore>

<!-- Default to portable build if not explicitly set -->
<PortableBuild Condition="'$(PortableBuild)' == ''">true</PortableBuild>

<OverrideRestoreOutputPath>true</OverrideRestoreOutputPath>
</PropertyGroup>

<!-- Output paths -->
<PropertyGroup>
<IntermediateOutputPathNonMangled Condition="'$(IntermediateOutputPathNonMangled)' == ''">$(RootArtifactsDir)obj/$(BuildOS)/$(BuildArch)/$(BuildType)/$(MSBuildProjectName)/</IntermediateOutputPathNonMangled>
<OutputPath Condition="'$(OutputPath)' == ''">$(BinDir)</OutputPath>
</PropertyGroup>

<!-- Provides properties for dependency versions and configures dependency verification/auto-upgrade. -->
<Import Project="$(ProjectDir)dependencies.props" />

<!-- Packaging properties -->
<PropertyGroup>
<LicenseUrl>https://github.com/dotnet/coreclr/blob/master/LICENSE.TXT</LicenseUrl>
<PackageDescriptionFile>$(SourceDir).nuget/descriptions.json</PackageDescriptionFile>
<PackageLicenseFile>$(ProjectDir)LICENSE.TXT</PackageLicenseFile>
<PackageThirdPartyNoticesFile>$(ProjectDir)THIRD-PARTY-NOTICES.TXT</PackageThirdPartyNoticesFile>
<SyncInfoDirectory>$(BaseIntermediateOutputPath)</SyncInfoDirectory>

<!-- If true, indicates that this is not an officially supported release -->
<!-- It is important to flip this to false in official release branches -->
<!-- Keep it in sync with PRERELEASE in clrdefinitions.cmake -->
<IsPrerelease>true</IsPrerelease>

<!-- This should be kept in sync with package details in src/.nuget/init/project.json -->
<RuntimeIdGraphDefinitionVersion>3.0.0-preview.19073.11</RuntimeIdGraphDefinitionVersion>
<RuntimeIdGraphDefinitionFile>$(PackagesDir)/microsoft.netcore.platforms/$(RuntimeIdGraphDefinitionVersion)/runtime.json</RuntimeIdGraphDefinitionFile>

<!-- This link should be updated for each release milestone, currently this points to 1.1.0-beta -->
<ReleaseNotes>https://go.microsoft.com/fwlink/?LinkID=799421</ReleaseNotes>

<ProjectUrl>https://dot.net</ProjectUrl>

<!-- On Windows, MSbuild can still run against Desktop FX while it runs on .NET Core on non-Windows. this requires
pulling in different packaging dependencies.
-->
<PackagingTaskDir Condition="'$(MSBuildRuntimeType)' != 'core'">$(ToolsDir)net46/</PackagingTaskDir>
<!-- defined in buildtools packaging.targets, but we need this before targets are imported -->
<PackagePlatform Condition="'$(PackagePlatform)' == ''">$(Platform)</PackagePlatform>
<PackagePlatform Condition="'$(PackagePlatform)' == 'amd64'">x64</PackagePlatform>
<MinOSForArch>win7</MinOSForArch>
<MinOSForArch Condition="'$(PackagePlatform)' == 'arm'">win8</MinOSForArch>
<MinOSForArch Condition="'$(PackagePlatform)' == 'arm64'">win10</MinOSForArch>
<!-- This property must be set to disable local package installation -->
<SkipInstallLocallyBuiltPackages>true</SkipInstallLocallyBuiltPackages>

<!-- Define packaging attributes for cross target components -->
<HasCrossTargetComponents Condition="'$(TargetsWindows)' == 'true' and ('$(PackagePlatform)' =='arm64' or '$(PackagePlatform)' =='arm')">true</HasCrossTargetComponents>
<HasCrossTargetComponents Condition="'$(TargetsLinux)' == 'true' and ('$(PackagePlatform)' =='arm64' or '$(PackagePlatform)' =='arm') and '$(__DoCrossArchBuild)' == '1'">true</HasCrossTargetComponents>
<CrossTargetComponentFolder Condition="'$(PackagePlatform)' == 'arm64'">x64</CrossTargetComponentFolder>
<CrossTargetComponentFolder Condition="'$(PackagePlatform)' == 'arm' and '$(TargetsWindows)' == 'true'">x86</CrossTargetComponentFolder>
<CrossTargetComponentFolder Condition="'$(PackagePlatform)' == 'arm' and '$(TargetsLinux)' == 'true'">x64</CrossTargetComponentFolder>

<PackageOutputPath Condition="'$(PackageOutputPath)' == ''">$(PackagesBinDir)/pkg/</PackageOutputPath>
<SymbolPackageOutputPath Condition="'$(SymbolPackageOutputPath)' == ''">$(PackagesBinDir)/symbolpkg/</SymbolPackageOutputPath>
<PackageIndexFile>$(MSBuildThisFileDirectory)/src/.nuget/packageIndex.json</PackageIndexFile>

<!-- coreclr doesn't currently use the index so don't force it to be in sync -->
<SkipIndexCheck>true</SkipIndexCheck>
</PropertyGroup>

<!-- Add required legal files to packages -->
<ItemGroup Condition="'$(MSBuildProjectExtension)' == '.pkgproj'">
<File Condition="Exists('$(PackageLicenseFile)')"
Include="$(PackageLicenseFile)" >
<SkipPackageFileCheck>true</SkipPackageFileCheck>
</File>
<File Condition="Exists('$(PackageThirdPartyNoticesFile)')"
Include="$(PackageThirdPartyNoticesFile)" >
<SkipPackageFileCheck>true</SkipPackageFileCheck>
</File>
<PackageIndex Include="$(PackageIndexFile)" />
</ItemGroup>


</Project>
2 changes: 1 addition & 1 deletion build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ set ghprbCommentBody=
:: __BuildArch -- default: x64
:: __BuildType -- default: Debug
:: __BuildOS -- default: Windows_NT
:: __ProjectDir -- default: directory of the dir.props file
:: __ProjectDir -- default: directory of the Directory.Build.Props file
:: __SourceDir -- default: %__ProjectDir%\src\
:: __PackagesDir -- default: %__ProjectDir%\packages\
:: __RootBinDir -- default: %__ProjectDir%\bin\
Expand Down
6 changes: 2 additions & 4 deletions build.proj
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk" DefaultTargets="Build">
<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" />
Expand Down Expand Up @@ -40,8 +38,8 @@
</Target>

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

</Project>
45 changes: 17 additions & 28 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ setup_dirs()
{
echo Setting up directories for build

mkdir -p "$__RootBinDir"
mkdir -p "$__RootArtifactsDir"
mkdir -p "$__BinDir"
mkdir -p "$__LogsDir"
mkdir -p "$__MsbuildDebugLogsDir"
Expand Down Expand Up @@ -442,7 +442,7 @@ build_CoreLib()
/p:UsePartialNGENOptimization=false /maxcpucount \
$__ProjectDir/build.proj \
/flp:Verbosity=normal\;LogFile=$__LogsDir/System.Private.CoreLib_$__BuildOS__$__BuildArch__$__BuildType.log \
/p:__IntermediatesDir=$__IntermediatesDir /p:__RootBinDir=$__RootBinDir /p:BuildNugetPackage=false \
/p:__IntermediatesDir=$__IntermediatesDir /p:__RootArtifactsDir=$__RootArtifactsDir /p:BuildNugetPackage=false \
$__CommonMSBuildArgs $__ExtraBuildArgs $__UnprocessedBuildArgs

if [ $? -ne 0 ]; then
Expand Down Expand Up @@ -505,7 +505,7 @@ generate_NugetPackages()
/p:UsePartialNGENOptimization=false /maxcpucount \
$__SourceDir/.nuget/packages.builds \
/flp:Verbosity=normal\;LogFile=$__LogsDir/Nuget_$__BuildOS__$__BuildArch__$__BuildType.log \
/p:__IntermediatesDir=$__IntermediatesDir /p:__RootBinDir=$__RootBinDir /p:BuildNugetPackages=false /p:__DoCrossArchBuild=$__CrossBuild \
/p:__IntermediatesDir=$__IntermediatesDir /p:__RootArtifactsDir=$__RootArtifactsDir /p:BuildNugetPackages=false /p:__DoCrossArchBuild=$__CrossBuild \
$__CommonMSBuildArgs $__UnprocessedBuildArgs

if [ $? -ne 0 ]; then
Expand Down Expand Up @@ -615,8 +615,8 @@ __IgnoreWarnings=0
export __ProjectDir="$__ProjectRoot"
export ArcadeBuild="true"
__SourceDir="$__ProjectDir/src"
__PackagesDir="${DotNetRestorePackagesPath:-${__ProjectDir}/packages}"
__RootBinDir="$__ProjectDir/artifacts"
__PackagesDir="${DotNetRestorePackagesPath:-${HOME}/.nuget/packages/}"
__RootArtifactsDir="$__ProjectDir/artifacts/"
__UnprocessedBuildArgs=
__CommonMSBuildArgs=
__MSBCleanBuildArgs=
Expand All @@ -637,7 +637,6 @@ __SkipRestoreOptData=0
__SkipCrossgen=0
__CrossgenOnly=0
__PartialNgen=0
__SkipTests=0
__CrossBuild=0
__ClangMajorVersion=0
__ClangMinorVersion=0
Expand Down Expand Up @@ -868,10 +867,6 @@ while :; do
__PartialNgen=1
;;

skiptests|-skiptests)
__SkipTests=1
;;

skipnuget|-skipnuget|skipbuildpackages|-skipbuildpackages)
__SkipNuget=1
;;
Expand All @@ -893,13 +888,13 @@ while :; do

bindir|-bindir)
if [ -n "$2" ]; then
__RootBinDir="$2"
if [ ! -d $__RootBinDir ]; then
mkdir $__RootBinDir
__RootArtifactsDir="$2"
if [ ! -d $__RootArtifactsDir ]; then
mkdir $__RootArtifactsDir
fi
__RootBinParent=$(dirname $__RootBinDir)
__RootBinName=${__RootBinDir##*/}
__RootBinDir="$(cd $__RootBinParent &>/dev/null && printf %s/%s $PWD $__RootBinName)"
__RootBinParent=$(dirname $__RootArtifactsDir)
__RootBinName=${__RootArtifactsDir##*/}
__RootArtifactsDir="$(cd $__RootBinParent &>/dev/null && printf %s/%s $PWD $__RootBinName)"
shift
else
echo "ERROR: 'bindir' requires a non-empty option argument"
Expand Down Expand Up @@ -990,16 +985,16 @@ if [ $__PortableBuild == 0 ]; then
fi

# Set dependent variables
__LogsDir="$__RootBinDir/Logs"
__LogsDir="$__RootArtifactsDir/log/${__BuildType}"
__MsbuildDebugLogsDir="$__LogsDir/MsbuildDebugLogs"

# Set the remaining variables based upon the determined build configuration
__BinDir="$__RootBinDir/bin/${__BuildOS}/${__BuildArch}/${__BuildType}"
__BinDir="$__RootArtifactsDir/Product/${__BuildOS}/${__BuildArch}/${__BuildType}"
__PackagesBinDir="$__BinDir/.nuget"
__ToolsDir="$__RootBinDir/tools"
__TestWorkingDir="$__RootBinDir/tests/$__BuildOS.$__BuildArch.$__BuildType"
export __IntermediatesDir="$__RootBinDir/obj/${__BuildOS}/${__BuildArch}/${__BuildType}"
__TestIntermediatesDir="$__RootBinDir/tests/obj/$__BuildOS.$__BuildArch.$__BuildType"
__ToolsDir="$__RootArtifactsDir/tools"
__TestWorkingDir="$__RootArtifactsDir/tests/$__BuildOS.$__BuildArch.$__BuildType"
export __IntermediatesDir="$__RootArtifactsDir/obj/${__BuildOS}/${__BuildArch}/${__BuildType}"
__TestIntermediatesDir="$__RootArtifactsDir/tests/obj/$__BuildOS.$__BuildArch.$__BuildType"
__isMSBuildOnNETCoreSupported=0
__CrossComponentBinDir="$__BinDir"

Expand Down Expand Up @@ -1055,12 +1050,6 @@ generate_event_logging
# Build the coreclr (native) components.
__ExtraCmakeArgs="-DCLR_CMAKE_TARGET_OS=$__BuildOS -DCLR_CMAKE_PACKAGES_DIR=$__PackagesDir -DCLR_CMAKE_PGO_INSTRUMENT=$__PgoInstrument -DCLR_CMAKE_OPTDATA_VERSION=$__PgoOptDataVersion -DCLR_CMAKE_PGO_OPTIMIZE=$__PgoOptimize"

# [TODO] Remove this when the `build-test.sh` script properly builds and deploys test assets.
if [ $__SkipTests != 1 ]; then
echo "Adding CMake flags to build native tests for $__BuildOS.$__BuildArch.$__BuildType"
__ExtraCmakeArgs="$__ExtraCmakeArgs -DCLR_CMAKE_BUILD_TESTS=ON"
fi

build_native $__SkipCoreCLR "$__BuildArch" "$__IntermediatesDir" "$__ExtraCmakeArgs" "CoreCLR component"

# Build cross-architecture components
Expand Down
2 changes: 1 addition & 1 deletion clrdefinitions.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include(clrfeatures.cmake)

# If set, indicates that this is not an officially supported release
# Keep in sync with IsPrerelease in dir.props
# Keep in sync with IsPrerelease in Directory.Build.Props
set(PRERELEASE 1)

# Features we're currently flighting, but don't intend to ship in officially supported releases
Expand Down
Loading