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:
parent
a19f9021a5
commit
cc1bb54f1a
7 changed files with 24 additions and 66 deletions
|
@ -3,5 +3,5 @@
|
|||
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.
|
||||
|
||||
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%
|
||||
|
|
15
build.proj
15
build.proj
|
@ -30,6 +30,13 @@
|
|||
|
||||
<CoreCLRVersion>1.0.2</CoreCLRVersion>
|
||||
<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>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -48,7 +55,13 @@
|
|||
Inputs="@(DotnetCliBuildFrameworkInputs)"
|
||||
Outputs="$(CLIBuildDll)"
|
||||
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 DependsOnTargets="$(CLITargets)" Name="BuildTheWholeCli"></Target>
|
||||
|
|
4
build.sh
4
build.sh
|
@ -49,12 +49,12 @@ args=($temp)
|
|||
|
||||
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
|
||||
if [ ! -z "$BUILD_IN_DOCKER" ]; then
|
||||
dockerbuild "${args[@]}"
|
||||
else
|
||||
$DIR/build_projects/dotnet-cli-build/build.sh "${args[@]}"
|
||||
$DIR/run_build.sh "${args[@]}"
|
||||
fi
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<Inputs>@(CompileStageInputs)</Inputs>
|
||||
<StageDirectory>$(Stage1Directory)</StageDirectory>
|
||||
<StageSymbolsDirectory>$(Stage1SymbolsDirectory)</StageSymbolsDirectory>
|
||||
<DotnetExe>$(Stage0Path)/dotnet$(ExeExtension)</DotnetExe>
|
||||
<DotnetExe>$(DotnetStage0)</DotnetExe>
|
||||
</Stage>
|
||||
<Stage Include="Stage2">
|
||||
<Inputs>@(CompileStageInputs)</Inputs>
|
||||
|
|
|
@ -22,12 +22,7 @@
|
|||
</GetCurrentRuntimeInformation>
|
||||
|
||||
<!-- Common Properties -->
|
||||
<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>
|
||||
<PropertyGroup>
|
||||
<DotNetPath>$(Stage0Path)</DotNetPath>
|
||||
|
||||
<BaseOutputDirectory>$(RepoRoot)/artifacts/$(Rid)</BaseOutputDirectory>
|
||||
|
|
|
@ -5,28 +5,24 @@
|
|||
|
||||
param(
|
||||
[string]$Configuration="Debug",
|
||||
[string[]]$Targets=@("Default"),
|
||||
[string]$Architecture="x64",
|
||||
[switch]$NoPackage,
|
||||
[switch]$NoRun,
|
||||
[switch]$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 "Options:"
|
||||
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 " -NoPackage Skip packaging targets"
|
||||
Write-Host " -NoRun Skip running the build"
|
||||
Write-Host " -Help Display this help message"
|
||||
exit 0
|
||||
}
|
||||
|
||||
$env:CONFIGURATION = $Configuration;
|
||||
$RepoRoot = "$PSScriptRoot\..\.."
|
||||
$RepoRoot = "$PSScriptRoot"
|
||||
$env:NUGET_PACKAGES = "$RepoRoot\.nuget\packages"
|
||||
|
||||
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
|
||||
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
|
||||
# Restore the build scripts
|
||||
Write-Host "Restoring Build Script projects..."
|
||||
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" }
|
||||
}
|
||||
dotnet build3 build.proj /p:Architecture=x64
|
||||
if($LASTEXITCODE -ne 0) { throw "Failed to restore" }
|
30
build_projects/dotnet-cli-build/build.sh → run_build.sh
Executable file → Normal file
30
build_projects/dotnet-cli-build/build.sh → run_build.sh
Executable file → Normal file
|
@ -25,16 +25,9 @@ while [[ $# > 0 ]]; do
|
|||
export CONFIGURATION=$2
|
||||
shift
|
||||
;;
|
||||
--targets)
|
||||
IFS=',' read -r -a targets <<< $2
|
||||
shift
|
||||
;;
|
||||
--nopackage)
|
||||
export DOTNET_BUILD_SKIP_PACKAGING=1
|
||||
;;
|
||||
--norun)
|
||||
export DOTNET_BUILD_SKIP_RUN=1
|
||||
;;
|
||||
--skip-prereqs)
|
||||
# Allow CI to disable prereqs check since the CI has the pre-reqs but not ldconfig it seems
|
||||
export DOTNET_INSTALL_SKIP_PREREQS=1
|
||||
|
@ -44,10 +37,8 @@ while [[ $# > 0 ]]; do
|
|||
echo ""
|
||||
echo "Options:"
|
||||
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 " --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 " --help Display this help message"
|
||||
exit 0
|
||||
|
@ -107,23 +98,4 @@ fi
|
|||
# Disable first run since we want to control all package sources
|
||||
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
|
||||
# Restore the build scripts
|
||||
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 $?
|
||||
dotnet build3 build.proj /p:Architecture=x64
|
Loading…
Reference in a new issue