Removing build scripts from dotnet-cli-build. Moving the stage0 to a run_build scripts and invoking dotnet build3 build.proj for the build.

This commit is contained in:
Livar Cunha 2016-07-05 15:09:39 -07:00
parent a19f9021a5
commit cc1bb54f1a
7 changed files with 24 additions and 66 deletions

View file

@ -3,5 +3,5 @@
REM Copyright (c) .NET Foundation and contributors. All rights reserved. REM Copyright (c) .NET Foundation and contributors. All rights reserved.
REM Licensed under the MIT license. See LICENSE file in the project root for full license information. REM Licensed under the MIT license. See LICENSE file in the project root for full license information.
powershell -NoProfile -NoLogo -Command "%~dp0build_projects\dotnet-cli-build\build.ps1 %*; exit $LastExitCode;" powershell -NoProfile -NoLogo -Command "%~dp0build.ps1 %*; exit $LastExitCode;"
if %errorlevel% neq 0 exit /b %errorlevel% if %errorlevel% neq 0 exit /b %errorlevel%

View file

@ -30,6 +30,13 @@
<CoreCLRVersion>1.0.2</CoreCLRVersion> <CoreCLRVersion>1.0.2</CoreCLRVersion>
<JitVersion>1.0.2</JitVersion> <JitVersion>1.0.2</JitVersion>
<Stage0Path Condition=" '$(OS)' == 'Windows_NT' ">$(RepoRoot)/.dotnet_stage0/Windows/$(Architecture)</Stage0Path>
<Stage0Path Condition=" '$(OSName)' == 'osx' ">$(RepoRoot)/.dotnet_stage0/Darwin</Stage0Path>
<Stage0Path Condition=" '$(Stage0Path)' == '' ">$(RepoRoot)/.dotnet_stage0/Linux</Stage0Path>
<ExeExtension>.exe</ExeExtension>
<ExeExtension Condition=" '$(OS)' != 'Windows_NT' "></ExeExtension>
<DotnetStage0>$(Stage0Path)/dotnet$(ExeExtension)</DotnetStage0>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -48,7 +55,13 @@
Inputs="@(DotnetCliBuildFrameworkInputs)" Inputs="@(DotnetCliBuildFrameworkInputs)"
Outputs="$(CLIBuildDll)" Outputs="$(CLIBuildDll)"
DependsOnTargets="MSBuildWorkaroundTarget"> DependsOnTargets="MSBuildWorkaroundTarget">
<Exec Command="$(PlatformScriptHost) $(MSBuildThisFileDirectory)/build_projects/dotnet-cli-build/build$(PlatformScriptExtension) $(NoRunArg)" WorkingDirectory="$(MSBuildThisFileDirectory)"/> <PropertyGroup>
<DotnetCliBuildDirectory>$(MSBuildThisFileDirectory)/build_projects/dotnet-cli-build</DotnetCliBuildDirectory>
</PropertyGroup>
<Exec Command="$(DotnetStage0) restore" WorkingDirectory="$(DotnetCliBuildDirectory)"/>
<Exec Command="$(DotnetStage0) publish -o $(DotnetCliBuildDirectory)/bin --framework netcoreapp1.0" WorkingDirectory="$(DotnetCliBuildDirectory)"/>
</Target> </Target>
<Target DependsOnTargets="$(CLITargets)" Name="BuildTheWholeCli"></Target> <Target DependsOnTargets="$(CLITargets)" Name="BuildTheWholeCli"></Target>

View file

@ -49,12 +49,12 @@ args=($temp)
dockerbuild() dockerbuild()
{ {
BUILD_COMMAND=/opt/code/build_projects/dotnet-cli-build/build.sh $DIR/scripts/dockerrun.sh --non-interactive "$@" BUILD_COMMAND=/opt/code/run_build.sh $DIR/scripts/dockerrun.sh --non-interactive "$@"
} }
# Check if we need to build in docker # Check if we need to build in docker
if [ ! -z "$BUILD_IN_DOCKER" ]; then if [ ! -z "$BUILD_IN_DOCKER" ]; then
dockerbuild "${args[@]}" dockerbuild "${args[@]}"
else else
$DIR/build_projects/dotnet-cli-build/build.sh "${args[@]}" $DIR/run_build.sh "${args[@]}"
fi fi

View file

@ -27,7 +27,7 @@
<Inputs>@(CompileStageInputs)</Inputs> <Inputs>@(CompileStageInputs)</Inputs>
<StageDirectory>$(Stage1Directory)</StageDirectory> <StageDirectory>$(Stage1Directory)</StageDirectory>
<StageSymbolsDirectory>$(Stage1SymbolsDirectory)</StageSymbolsDirectory> <StageSymbolsDirectory>$(Stage1SymbolsDirectory)</StageSymbolsDirectory>
<DotnetExe>$(Stage0Path)/dotnet$(ExeExtension)</DotnetExe> <DotnetExe>$(DotnetStage0)</DotnetExe>
</Stage> </Stage>
<Stage Include="Stage2"> <Stage Include="Stage2">
<Inputs>@(CompileStageInputs)</Inputs> <Inputs>@(CompileStageInputs)</Inputs>

View file

@ -22,12 +22,7 @@
</GetCurrentRuntimeInformation> </GetCurrentRuntimeInformation>
<!-- Common Properties --> <!-- Common Properties -->
<PropertyGroup> <PropertyGroup>
<Stage0Path Condition=" '$(OSName)' == 'win' ">$(RepoRoot)/.dotnet_stage0/Windows/$(Architecture)</Stage0Path>
<Stage0Path Condition=" '$(OSName)' == 'osx' ">$(RepoRoot)/.dotnet_stage0/Darwin</Stage0Path>
<Stage0Path Condition=" '$(Stage0Path)' == '' ">$(RepoRoot)/.dotnet_stage0/Linux</Stage0Path>
<ExeExtension>.exe</ExeExtension>
<ExeExtension Condition="'$OSName)' != 'win' "></ExeExtension>
<DotNetPath>$(Stage0Path)</DotNetPath> <DotNetPath>$(Stage0Path)</DotNetPath>
<BaseOutputDirectory>$(RepoRoot)/artifacts/$(Rid)</BaseOutputDirectory> <BaseOutputDirectory>$(RepoRoot)/artifacts/$(Rid)</BaseOutputDirectory>

View file

@ -5,28 +5,24 @@
param( param(
[string]$Configuration="Debug", [string]$Configuration="Debug",
[string[]]$Targets=@("Default"),
[string]$Architecture="x64", [string]$Architecture="x64",
[switch]$NoPackage, [switch]$NoPackage,
[switch]$NoRun,
[switch]$Help) [switch]$Help)
if($Help) if($Help)
{ {
Write-Host "Usage: .\build.ps1 [-Configuration <CONFIGURATION>] [-Targets <TARGETS...>] [-Architecture <ARCHITECTURE>] [-NoPackage] [-Help]" Write-Host "Usage: .\build.ps1 [-Configuration <CONFIGURATION>] [-Architecture <ARCHITECTURE>] [-NoPackage] [-Help]"
Write-Host "" Write-Host ""
Write-Host "Options:" Write-Host "Options:"
Write-Host " -Configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)" Write-Host " -Configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)"
Write-Host " -Targets <TARGETS...> Comma separated build targets to run (Init, Compile, Publish, etc.; Default is a full build and publish)"
Write-Host " -Architecture <ARCHITECTURE> Build the specified architecture (x64 or x86 (supported only on Windows), default: x64)" Write-Host " -Architecture <ARCHITECTURE> Build the specified architecture (x64 or x86 (supported only on Windows), default: x64)"
Write-Host " -NoPackage Skip packaging targets" Write-Host " -NoPackage Skip packaging targets"
Write-Host " -NoRun Skip running the build"
Write-Host " -Help Display this help message" Write-Host " -Help Display this help message"
exit 0 exit 0
} }
$env:CONFIGURATION = $Configuration; $env:CONFIGURATION = $Configuration;
$RepoRoot = "$PSScriptRoot\..\.." $RepoRoot = "$PSScriptRoot"
$env:NUGET_PACKAGES = "$RepoRoot\.nuget\packages" $env:NUGET_PACKAGES = "$RepoRoot\.nuget\packages"
if($NoPackage) if($NoPackage)
@ -69,23 +65,5 @@ $env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
# Disable first run since we want to control all package sources # Disable first run since we want to control all package sources
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
# Restore the build scripts dotnet build3 build.proj /p:Architecture=x64
Write-Host "Restoring Build Script projects..." if($LASTEXITCODE -ne 0) { throw "Failed to restore" }
pushd "$PSScriptRoot"
dotnet restore
if($LASTEXITCODE -ne 0) { throw "Failed to restore" }
popd
# Publish the builder
Write-Host "Compiling Build Scripts..."
dotnet publish "$PSScriptRoot" -o "$PSScriptRoot\bin" --framework netcoreapp1.0
if($LASTEXITCODE -ne 0) { throw "Failed to compile build scripts" }
if(!$NoRun)
{
# Run the builder
Write-Host "Invoking Build Scripts..."
Write-Host " Configuration: $env:CONFIGURATION"
& "$PSScriptRoot\bin\dotnet-cli-build.exe" @Targets
if($LASTEXITCODE -ne 0) { throw "Build failed" }
}

View file

@ -25,16 +25,9 @@ while [[ $# > 0 ]]; do
export CONFIGURATION=$2 export CONFIGURATION=$2
shift shift
;; ;;
--targets)
IFS=',' read -r -a targets <<< $2
shift
;;
--nopackage) --nopackage)
export DOTNET_BUILD_SKIP_PACKAGING=1 export DOTNET_BUILD_SKIP_PACKAGING=1
;; ;;
--norun)
export DOTNET_BUILD_SKIP_RUN=1
;;
--skip-prereqs) --skip-prereqs)
# Allow CI to disable prereqs check since the CI has the pre-reqs but not ldconfig it seems # Allow CI to disable prereqs check since the CI has the pre-reqs but not ldconfig it seems
export DOTNET_INSTALL_SKIP_PREREQS=1 export DOTNET_INSTALL_SKIP_PREREQS=1
@ -44,10 +37,8 @@ while [[ $# > 0 ]]; do
echo "" echo ""
echo "Options:" echo "Options:"
echo " --configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)" echo " --configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)"
echo " --targets <TARGETS...> Comma separated build targets to run (Init, Compile, Publish, etc.; Default is a full build and publish)"
echo " --skip-prereqs Skip checks for pre-reqs in dotnet_install" echo " --skip-prereqs Skip checks for pre-reqs in dotnet_install"
echo " --nopackage Skip packaging targets" echo " --nopackage Skip packaging targets"
echo " --norun Skip running the build"
echo " --docker <IMAGENAME> Build in Docker using the Dockerfile located in scripts/docker/IMAGENAME" echo " --docker <IMAGENAME> Build in Docker using the Dockerfile located in scripts/docker/IMAGENAME"
echo " --help Display this help message" echo " --help Display this help message"
exit 0 exit 0
@ -107,23 +98,4 @@ fi
# Disable first run since we want to control all package sources # Disable first run since we want to control all package sources
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
# Restore the build scripts dotnet build3 build.proj /p:Architecture=x64
echo "Restoring Build Script projects..."
(
cd "$DIR"
dotnet restore
)
# Build the builder
echo "Compiling Build Scripts..."
dotnet publish "$DIR" -o "$DIR/bin" --framework netcoreapp1.0
if [ -z "$DOTNET_BUILD_SKIP_RUN" ]; then
export PATH="$OLDPATH"
# Run the builder
echo "Invoking Build Scripts..."
echo "Configuration: $CONFIGURATION"
$DIR/bin/dotnet-cli-build ${targets[@]}
fi
exit $?