Making some of the testbase methods protected.

Renaming variables according to code review comments. Adding the folder logic to the builder tests. Creating a separate compilation folder during the build.
This commit is contained in:
Livar Cunha 2016-01-21 15:01:21 -08:00 committed by Livar Cunha
parent b459c3665e
commit fdea0b87e0
24 changed files with 132 additions and 131 deletions

View file

@ -9,6 +9,6 @@ header "Compiling stage1 dotnet using downloaded stage0 ..."
$StartPath = $env:PATH
$env:PATH = "$env:DOTNET_INSTALL_DIR\cli\bin;$StartPath"
_ "$RepoRoot\scripts\compile\compile-stage.ps1" @("$Tfm","$Rid","$Configuration","$Stage1Dir","$RepoRoot","$HostDir")
_ "$RepoRoot\scripts\compile\compile-stage.ps1" @("$Tfm","$Rid","$Configuration","$Stage1Dir","$RepoRoot","$HostDir", "$Stage1CompilationDir")
$env:PATH=$StartPath

View file

@ -21,6 +21,6 @@ export PATH=$DOTNET_INSTALL_DIR/bin:$PATH
# Build Stage 1
header "Building stage1 dotnet using downloaded stage0 ..."
OUTPUT_DIR=$STAGE1_DIR $REPOROOT/scripts/compile/compile-stage.sh
COMPILATION_OUTPUT_DIR=$STAGE1_COMPILATION_DIR OUTPUT_DIR=$STAGE1_DIR $REPOROOT/scripts/compile/compile-stage.sh
export PATH=$StartPath

View file

@ -10,6 +10,6 @@ $StartPath = $env:PATH
$env:PATH = "$Stage1Dir\bin;$env:PATH"
# Compile
_ "$RepoRoot\scripts\compile\compile-stage.ps1" @("$Tfm","$Rid","$Configuration","$Stage2Dir","$RepoRoot","$HostDir")
_ "$RepoRoot\scripts\compile\compile-stage.ps1" @("$Tfm","$Rid","$Configuration","$Stage2Dir","$RepoRoot","$HostDir", "$Stage2CompilationDir")
$env:PATH=$StartPath

View file

@ -23,7 +23,7 @@ export PATH=$STAGE1_DIR/bin:$PATH
# Compile Stage 2
header "Compiling stage2 dotnet using just-built stage1 ..."
OUTPUT_DIR=$STAGE2_DIR $REPOROOT/scripts/compile/compile-stage.sh
COMPILATION_OUTPUT_DIR=$STAGE2_COMPILATION_DIR OUTPUT_DIR=$STAGE2_DIR $REPOROOT/scripts/compile/compile-stage.sh
export DOTNET_HOME=$STAGE2_DIR
export DOTNET_TOOLS=$STAGE2_DIR

View file

@ -9,7 +9,8 @@ param(
[Parameter(Mandatory=$true)][string]$Configuration,
[Parameter(Mandatory=$true)][string]$OutputDir,
[Parameter(Mandatory=$true)][string]$RepoRoot,
[Parameter(Mandatory=$true)][string]$HostDir)
[Parameter(Mandatory=$true)][string]$HostDir,
[Parameter(Mandatory=$true)][string]$CompilationOutputDir)
$Projects = @(
"Microsoft.DotNet.Cli",
@ -49,35 +50,47 @@ $FilesToClean = @(
)
$RuntimeOutputDir = "$OutputDir\runtime\coreclr"
$binariesOutputDir = "$OutputDir\bin\$Configuration\$Tfm"
$runtimeBinariesOutputDir = "$RuntimeOutputDir\$Configuration\$Tfm"
$binariesOutputDir = "$CompilationOutputDir\bin\$Configuration\$Tfm"
$runtimeBinariesOutputDir = "$CompilationOutputDir\runtime\coreclr\$Configuration\$Tfm"
if(!(Test-Path $OutputDir\bin))
{
mkdir $OutputDir\bin | Out-Null
}
if(!(Test-Path $RuntimeOutputDir))
{
mkdir $RuntimeOutputDir | Out-Null
}
# Publish each project
$Projects | ForEach-Object {
dotnet publish --native-subdirectory --framework "$Tfm" --runtime "$Rid" --output "$OutputDir\bin" --configuration "$Configuration" "$RepoRoot\src\$_"
dotnet publish --native-subdirectory --framework "$Tfm" --runtime "$Rid" --output "$CompilationOutputDir\bin" --configuration "$Configuration" "$RepoRoot\src\$_"
if (!$?) {
Write-Host Command failed: dotnet publish --native-subdirectory --framework "$Tfm" --runtime "$Rid" --output "$OutputDir\bin" --configuration "$Configuration" "$RepoRoot\src\$_"
Write-Host Command failed: dotnet publish --native-subdirectory --framework "$Tfm" --runtime "$Rid" --output "$CompilationOutputDir\bin" --configuration "$Configuration" "$RepoRoot\src\$_"
exit 1
}
}
if (Test-Path $binariesOutputDir) {
cp $binariesOutputDir\* $OutputDir\bin -force -recurse
Remove-Item $binariesOutputDir -recurse
if (! (Test-Path $binariesOutputDir)) {
$binariesOutputDir = "$CompilationOutputDir\bin"
}
cp $binariesOutputDir\* $OutputDir\bin -force -recurse
# Publish the runtime
dotnet publish --framework "$Tfm" --runtime "$Rid" --output "$RuntimeOutputDir" --configuration "$Configuration" "$RepoRoot\src\Microsoft.DotNet.Runtime"
dotnet publish --framework "$Tfm" --runtime "$Rid" --output "$CompilationOutputDir\runtime\coreclr" --configuration "$Configuration" "$RepoRoot\src\Microsoft.DotNet.Runtime"
if (!$?) {
Write-Host Command failed: dotnet publish --framework "$Tfm" --runtime "$Rid" --output "$RuntimeOutputDir" --configuration "$Configuration" "$RepoRoot\src\Microsoft.DotNet.Runtime"
Write-Host Command failed: dotnet publish --framework "$Tfm" --runtime "$Rid" --output "$CompilationOutputDir\runtime\coreclr" --configuration "$Configuration" "$RepoRoot\src\Microsoft.DotNet.Runtime"
Exit 1
}
if (Test-Path $runtimeBinariesOutputDir) {
cp $runtimeBinariesOutputDir\* $RuntimeOutputDir -force -recurse
Remove-Item $runtimeBinariesOutputDir -recurse
if (! (Test-Path $runtimeBinariesOutputDir)) {
$runtimeBinariesOutputDir = "$CompilationOutputDir\runtime\coreclr"
}
cp $runtimeBinariesOutputDir\* $RuntimeOutputDir -force -recurse
# Clean up bogus additional files
$FilesToClean | ForEach-Object {
$path = Join-Path $RuntimeOutputDir $_

View file

@ -21,6 +21,7 @@ source "$DIR/../common/_common.sh"
[ ! -z "$CONFIGURATION" ] || die "Missing required environment variable CONFIGURATION"
[ ! -z "$OUTPUT_DIR" ] || die "Missing required environment variable OUTPUT_DIR"
[ ! -z "$HOST_DIR" ] || die "Missing required environment variable HOST_DIR"
[ ! -z "$COMPILATION_OUTPUT_DIR" ] || die "Missing required environment variable COMPILATION_OUTPUT_DIR"
PROJECTS=( \
Microsoft.DotNet.Cli \
@ -56,29 +57,32 @@ FILES_TO_CLEAN=( \
)
RUNTIME_OUTPUT_DIR="$OUTPUT_DIR/runtime/coreclr"
BINARIES_OUTPUT_DIR="$OUTPUT_DIR/bin/$CONFIGURATION/$TFM"
RUNTIME_BINARIES_OUTPUT_DIR="$RUNTIME_OUTPUT_DIR/$CONFIGURATION/$TFM"
BINARIES_OUTPUT_DIR="$COMPILATION_OUTPUT_DIR/bin/$CONFIGURATION/$TFM"
RUNTIME_BINARIES_OUTPUT_DIR="$COMPILATION_OUTPUT_DIR/runtime/coreclr/$CONFIGURATION/$TFM"
mkdir -p "$OUTPUT_DIR/bin"
mkdir -p "$RUNTIME_OUTPUT_DIR"
for project in ${PROJECTS[@]}
do
echo dotnet publish --native-subdirectory --framework "$TFM" --output "$OUTPUT_DIR/bin" --configuration "$CONFIGURATION" "$REPOROOT/src/$project"
dotnet publish --native-subdirectory --framework "$TFM" --output "$OUTPUT_DIR/bin" --configuration "$CONFIGURATION" "$REPOROOT/src/$project"
echo dotnet publish --native-subdirectory --framework "$TFM" --output "$COMPILATION_OUTPUT_DIR/bin" --configuration "$CONFIGURATION" "$REPOROOT/src/$project"
dotnet publish --native-subdirectory --framework "$TFM" --output "$COMPILATION_OUTPUT_DIR/bin" --configuration "$CONFIGURATION" "$REPOROOT/src/$project"
done
if [ -d "$BINARIES_OUTPUT_DIR" ]
if [ ! -d "$BINARIES_OUTPUT_DIR" ]
then
cp -R -f $BINARIES_OUTPUT_DIR/* $OUTPUT_DIR/bin
BINARIES_OUTPUT_DIR="$COMPILATION_OUTPUT_DIR/bin"
fi
rm -rf $OUTPUT_DIR/bin/$CONFIGURATION
cp -R -f $BINARIES_OUTPUT_DIR/* $OUTPUT_DIR/bin
# Bring in the runtime
dotnet publish --output "$RUNTIME_OUTPUT_DIR" --configuration "$CONFIGURATION" "$REPOROOT/src/Microsoft.DotNet.Runtime"
dotnet publish --output "$COMPILATION_OUTPUT_DIR/runtime/coreclr" --configuration "$CONFIGURATION" "$REPOROOT/src/Microsoft.DotNet.Runtime"
if [ -d "$RUNTIME_BINARIES_OUTPUT_DIR" ]
if [ ! -d "$RUNTIME_BINARIES_OUTPUT_DIR" ]
then
cp -R -f $RUNTIME_BINARIES_OUTPUT_DIR/* $RUNTIME_OUTPUT_DIR
RUNTIME_BINARIES_OUTPUT_DIR="$COMPILATION_OUTPUT_DIR/runtime/coreclr"
fi
rm -rf "$RUNTIME_OUTPUT_DIR/$CONFIGURATION"
cp -R -f $RUNTIME_BINARIES_OUTPUT_DIR/* $RUNTIME_OUTPUT_DIR
# Clean up bogus additional files
for file in ${FILES_TO_CLEAN[@]}