restructure the output layout

also reorganize the scripts folder
This commit is contained in:
Andrew Stanton-Nurse 2015-11-10 17:30:01 -08:00
parent df3a5fba7a
commit 4cc15b1246
61 changed files with 926 additions and 3213 deletions

View file

@ -0,0 +1,66 @@
param(
[Parameter(Mandatory=$true)][string]$Tfm,
[Parameter(Mandatory=$true)][string]$Rid,
[Parameter(Mandatory=$true)][string]$Configuration,
[Parameter(Mandatory=$true)][string]$OutputDir,
[Parameter(Mandatory=$true)][string]$RepoRoot,
[Parameter(Mandatory=$true)][string]$HostDir)
$Projects = @(
"Microsoft.DotNet.Cli",
"Microsoft.DotNet.Tools.Compiler",
"Microsoft.DotNet.Tools.Compiler.Csc",
"Microsoft.DotNet.Tools.Publish",
"Microsoft.DotNet.Tools.Resgen",
"Microsoft.DotNet.Tools.Run"
)
$BinariesForCoreHost = @(
"csc"
"vbc"
)
$FilesToClean = @(
"README.md"
"Microsoft.DotNet.Runtime.exe"
"Microsoft.DotNet.Runtime.dll"
"Microsoft.DotNet.Runtime.deps"
"Microsoft.DotNet.Runtime.pdb"
)
if (Test-Path $OutputDir) {
del -rec -for $OutputDir
}
$RuntimeOutputDir = "$OutputDir\runtime\coreclr"
# Publish each project
$Projects | ForEach-Object {
dotnet publish --framework "$Tfm" --runtime "$Rid" --output "$OutputDir\bin" --configuration "$Configuration" "$RepoRoot\src\$_"
}
# Publish the runtime
dotnet publish --framework "$Tfm" --runtime "$Rid" --output "$RuntimeOutputDir" --configuration "$Configuration" "$RepoRoot\src\Microsoft.DotNet.Runtime"
# Clean up bogus additional files
$FilesToClean | ForEach-Object {
$path = Join-Path $RuntimeOutputDir $_
if (Test-Path $path) {
del -for $path
}
}
# Copy the runtime app-local for the tools
cp -rec "$RuntimeOutputDir\*" "$OutputDir\bin"
# Deploy the CLR host to the output
cp "$HostDir\corehost.exe" "$OutputDir\bin"
# corehostify externally-provided binaries (csc, vbc, etc.)
$BinariesForCoreHost | ForEach-Object {
mv $OutputDir\bin\$_.exe $OutputDir\bin\$_.dll
cp $OutputDir\bin\corehost.exe $OutputDir\bin\$_.exe
}
# remove any deps files that got brought along (they aren't needed because we have an app-local runtime and dependencies)
del $OutputDir\bin\*.deps

83
scripts/build/build-stage.sh Executable file
View file

@ -0,0 +1,83 @@
#!/usr/bin/env bash
set -e
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
REPOROOT="$( cd -P "$DIR/../.." && pwd )"
source "$DIR/../_common.sh"
[ ! -z "$TFM" ] || die "Missing required environment variable TFM"
[ ! -z "$RID" ] || die "Missing required environment variable RID"
[ ! -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"
PROJECTS=( \
Microsoft.DotNet.Cli \
Microsoft.DotNet.Tools.Compiler \
Microsoft.DotNet.Tools.Compiler.Csc \
Microsoft.DotNet.Tools.Publish \
Microsoft.DotNet.Tools.Resgen \
Microsoft.DotNet.Tools.Run \
)
BINARIES_FOR_COREHOST=( \
csc \
vbc \
)
FILES_TO_CLEAN=( \
README.md \
Microsoft.DotNet.Runtime \
Microsoft.DotNet.Runtime.dll \
Microsoft.DotNet.Runtime.deps \
Microsoft.DotNet.Runtime.pdb \
)
# Clean up output
[ -d "$OUTPUT_DIR" ] && rm -Rf "$OUTPUT_DIR"
RUNTIME_OUTPUT_DIR="$OUTPUT_DIR/runtime/coreclr"
for project in ${PROJECTS[@]}
do
dotnet publish --framework "$TFM" --runtime "$RID" --output "$OUTPUT_DIR/bin" --configuration "$CONFIGURATION" "$REPOROOT/src/$project"
done
# Bring in the runtime
dotnet publish --framework "$TFM" --runtime "$RID" --output "$RUNTIME_OUTPUT_DIR" --configuration "$CONFIGURATION" "$REPOROOT/src/Microsoft.DotNet.Runtime"
# Clean up bogus additional files
for file in ${FILES_TO_CLEAN[@]}
do
[ -e "$RUNTIME_OUTPUT_DIR/$file" ] && rm "$RUNTIME_OUTPUT_DIR/$file"
done
# Copy the runtime app-local for the tools
cp -R $RUNTIME_OUTPUT_DIR/* $OUTPUT_DIR/bin
# Deploy CLR host to the output
cp "$HOST_DIR/corehost" "$OUTPUT_DIR/bin"
# corehostify externally-provided binaries (csc, vbc, etc.)
for binary in ${BINARIES_FOR_COREHOST[@]}
do
cp $OUTPUT_DIR/bin/corehost $OUTPUT_DIR/bin/$binary
mv $OUTPUT_DIR/bin/${binary}.exe $OUTPUT_DIR/bin/${binary}.dll
done
# remove any deps files that got brought along (they aren't needed because we have an app-local runtime and dependencies)
rm $OUTPUT_DIR/bin/*.deps
cd $OUTPUT_DIR
# Fix up permissions. Sometimes they get dropped with the wrong info
find . -type f | xargs chmod 644
$DIR/fix-mode-flags.sh

15
scripts/build/fix-mode-flags.sh Executable file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Managed code doesn't need 'x'
find . -type f -name "*.dll" | xargs chmod 644
find . -type f -name "*.exe" | xargs chmod 644
# Generally, dylibs and sos have 'x' (no idea if it's required ;))
if [ "$(uname)" == "Darwin" ]; then
find . -type f -name "*.dylib" | xargs chmod 755
else
find . -type f -name "*.so" | xargs chmod 755
fi
# Executables (those without dots) are executable :)
find . -type f ! -name "*.*" | xargs chmod 755