From e91db7dce1ebd63381d3b44e2fca49f0c5e3d068 Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Tue, 29 Dec 2015 02:34:10 -0800 Subject: [PATCH] Eliminate dead code and most relative paths --- scripts/build/build-stage.ps1 | 86 -------------- scripts/build/build-stage.sh | 93 --------------- scripts/compile.ps1 | 188 ------------------------------ scripts/compile.sh | 164 -------------------------- scripts/compile/compile-stage.sh | 1 - scripts/dev-dotnet.sh | 3 +- scripts/docker/dockerbuild.sh | 4 +- scripts/docker/dockerrun.sh | 2 +- scripts/package/package-debian.sh | 2 +- scripts/package/package-dnvm.sh | 13 +-- scripts/package/package.sh | 4 +- scripts/publish/publish.sh | 7 +- 12 files changed, 12 insertions(+), 555 deletions(-) delete mode 100644 scripts/build/build-stage.ps1 delete mode 100755 scripts/build/build-stage.sh delete mode 100644 scripts/compile.ps1 delete mode 100755 scripts/compile.sh diff --git a/scripts/build/build-stage.ps1 b/scripts/build/build-stage.ps1 deleted file mode 100644 index 94380d80e..000000000 --- a/scripts/build/build-stage.ps1 +++ /dev/null @@ -1,86 +0,0 @@ -# -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. -# - -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.Builder", - "Microsoft.DotNet.Tools.Compiler.Csc", - "Microsoft.DotNet.Tools.Compiler.Fsc", - "Microsoft.DotNet.Tools.Compiler.Native", - "Microsoft.DotNet.Tools.New", - "Microsoft.DotNet.Tools.Pack", - "Microsoft.DotNet.Tools.Publish", - "Microsoft.DotNet.Tools.Repl", - "Microsoft.DotNet.Tools.Repl.Csi", - "Microsoft.DotNet.Tools.Resgen", - "Microsoft.DotNet.Tools.Run", - "Microsoft.DotNet.Tools.Test" -) - -$BinariesForCoreHost = @( - "csi" - "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\$_" - if (!$?) { - Write-Host Command failed: dotnet publish --framework "$Tfm" --runtime "$Rid" --output "$OutputDir\bin" --configuration "$Configuration" "$RepoRoot\src\$_" - exit 1 - } -} - -# Publish the runtime -dotnet publish --framework "$Tfm" --runtime "$Rid" --output "$RuntimeOutputDir" --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" - Exit 1 -} - - -# 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 -} diff --git a/scripts/build/build-stage.sh b/scripts/build/build-stage.sh deleted file mode 100755 index d347900e3..000000000 --- a/scripts/build/build-stage.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. -# - -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.Builder \ - Microsoft.DotNet.Tools.Compiler.Csc \ - Microsoft.DotNet.Tools.Compiler.Fsc \ - Microsoft.DotNet.Tools.Compiler.Native \ - Microsoft.DotNet.Tools.New \ - Microsoft.DotNet.Tools.Pack \ - Microsoft.DotNet.Tools.Publish \ - Microsoft.DotNet.Tools.Repl \ - Microsoft.DotNet.Tools.Repl.Csi \ - Microsoft.DotNet.Tools.Resgen \ - Microsoft.DotNet.Tools.Run \ - Microsoft.DotNet.Tools.Test \ -) - -BINARIES_FOR_COREHOST=( \ - csi \ - 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 - -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 diff --git a/scripts/compile.ps1 b/scripts/compile.ps1 deleted file mode 100644 index ef324d74a..000000000 --- a/scripts/compile.ps1 +++ /dev/null @@ -1,188 +0,0 @@ -# -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. -# - -param([string]$Configuration = "Debug", - [switch]$Offline) - -$ErrorActionPreference="Stop" - -. $PSScriptRoot\_common.ps1 - -# Capture PATH for later -$StartPath = $env:PATH -$StartDotNetHome = $env:DOTNET_HOME - -function getDnx() -{ - $DnxPackage = "dnx-coreclr-win-x64.1.0.0-rc1-update1.nupkg" - $DnxVersion = "1.0.0-rc1-16231" - $DnxDir = "$OutputDir\dnx" - $DnxRoot = "$DnxDir/bin" - - # check if the required dnx version is already downloaded - if ((Test-Path "$DnxRoot\dnx.exe")) { - $dnxOut = & "$DnxRoot\dnx.exe" --version - - if ($dnxOut -Match $DnxVersion) { - Write-Host "Dnx version - $DnxVersion already downloaded." - return $DnxRoot - } - } - - # Download dnx to copy to stage2 - Remove-Item -Recurse -Force -ErrorAction Ignore $DnxDir - mkdir -Force "$DnxDir" | Out-Null - - Write-Host "Downloading Dnx version - $DnxVersion." - $DnxUrl="https://api.nuget.org/packages/$DnxPackage" - Invoke-WebRequest -UseBasicParsing "$DnxUrl" -OutFile "$DnxDir\dnx.zip" - - Add-Type -Assembly System.IO.Compression.FileSystem | Out-Null - [System.IO.Compression.ZipFile]::ExtractToDirectory("$DnxDir\dnx.zip", "$DnxDir") - return $DnxRoot -} - -try { - - # Check prereqs - if (!(Get-Command -ErrorAction SilentlyContinue cmake)) { - throw @" -cmake is required to build the native host 'corehost' -Download it from https://www.cmake.org -"@ - } - - if($Offline){ - Write-Host "Skipping Stage 0, Dnx, and Packages dowlnoad: Offline build" - } - else { - # Install a stage 0 - header "Installing dotnet stage 0" - & "$PSScriptRoot\install.ps1" - if (!$?) { - Write-Host "Command failed: $PSScriptRoot\install.ps1" - Exit 1 - } - - # Put stage 0 on the path - $DotNetTools = $env:DOTNET_INSTALL_DIR - if (!$DotNetTools) { - $DotNetTools = "$($env:LOCALAPPDATA)\Microsoft\dotnet" - } - - $DnxRoot = getDnx - - # Restore packages - header "Restoring packages" - & "$DnxRoot\dnu" restore "$RepoRoot\src" --quiet --runtime "$Rid" --no-cache - & "$DnxRoot\dnu" restore "$RepoRoot\test" --quiet --runtime "$Rid" --no-cache - & "$DnxRoot\dnu" restore "$RepoRoot\tools" --quiet --runtime "$Rid" --no-cache - - $oldErrorAction=$ErrorActionPreference - $ErrorActionPreference="SilentlyContinue" - & "$DnxRoot\dnu" restore "$RepoRoot\testapp" --quiet --runtime "$Rid" --no-cache 2>&1 | Out-Null - $ErrorActionPreference=$oldErrorAction - - if (!$?) { - Write-Host "Command failed: " "$DnxRoot\dnu" restore "$RepoRoot" --quiet --runtime "$Rid" --no-cache - Exit 1 - } - } - - header "Building corehost" - pushd "$RepoRoot\src\corehost" - try { - if (!(Test-Path "cmake\$Rid")) { - mkdir "cmake\$Rid" | Out-Null - } - cd "cmake\$Rid" - cmake ..\.. -G "Visual Studio 14 2015 Win64" - $pf = $env:ProgramFiles - if (Test-Path "env:\ProgramFiles(x86)") { - $pf = (cat "env:\ProgramFiles(x86)") - } - & "$pf\MSBuild\14.0\Bin\MSBuild.exe" ALL_BUILD.vcxproj /p:Configuration="$Configuration" - if (!$?) { - Write-Host "Command failed: $pf\MSBuild\14.0\Bin\MSBuild.exe" ALL_BUILD.vcxproj /p:Configuration="$Configuration" - Exit 1 - } - - if (!(Test-Path $HostDir)) { - mkdir $HostDir | Out-Null - } - cp "$RepoRoot\src\corehost\cmake\$Rid\$Configuration\corehost.exe" $HostDir - - if (Test-Path "$RepoRoot\src\corehost\cmake\$Rid\$Configuration\corehost.pdb") - { - cp "$RepoRoot\src\corehost\cmake\$Rid\$Configuration\corehost.pdb" $HostDir - } - } finally { - popd - } - - # Build Stage 1 - header "Building stage1 dotnet using downloaded stage0 ..." - & "$PSScriptRoot\build\build-stage.ps1" -Tfm:$Tfm -Rid:$Rid -Configuration:$Configuration -OutputDir:$Stage1Dir -RepoRoot:$RepoRoot -HostDir:$HostDir - if (!$?) { - Write-Host "Command failed: $PSScriptRoot\build\build-stage.ps1" -Tfm:$Tfm -Rid:$Rid -Configuration:$Configuration -OutputDir:$Stage1Dir -RepoRoot:$RepoRoot -HostDir:$HostDir - Exit 1 - } - - - # Build Stage 2 using Stage 1 - $env:PATH = "$Stage1Dir\bin;$StartPath" - header "Building stage2 dotnet using just-built stage1 ..." - & "$PSScriptRoot\build\build-stage.ps1" -Tfm:$Tfm -Rid:$Rid -Configuration:$Configuration -OutputDir:$Stage2Dir -RepoRoot:$RepoRoot -HostDir:$HostDir - if (!$?) { - Write-Host "Command failed: $PSScriptRoot\build\build-stage.ps1" -Tfm:$Tfm -Rid:$Rid -Configuration:$Configuration -OutputDir:$Stage2Dir -RepoRoot:$RepoRoot -HostDir:$HostDir - Exit 1 - } - - - # Crossgen Roslyn - header "Crossgening Roslyn compiler ..." - cmd /c "$PSScriptRoot\crossgen\crossgen_roslyn.cmd" "$Stage2Dir" - if (!$?) { - Write-Host "Command failed: " cmd /c "$PSScriptRoot\crossgen\crossgen_roslyn.cmd" "$Stage2Dir" - Exit 1 - } - - - # Copy dnx into stage 2 - cp -rec "$DnxRoot\" "$Stage2Dir\bin\dnx\" - - # Copy in the dotnet-restore script - cp "$PSScriptRoot\dotnet-restore.cmd" "$Stage2Dir\bin\dotnet-restore.cmd" - - # Copy in AppDeps - $env:PATH = "$Stage2Dir\bin;$StartPath" - header "Acquiring Native App Dependencies" - cmd /c "$PSScriptRoot\build\build_appdeps.cmd" "$Stage2Dir" - if (!$?) { - Write-Host "Command failed: " cmd /c "$PSScriptRoot\build\build_appdeps.cmd" "$Stage2Dir" - Exit 1 - } - - $env:DOTNET_HOME = "$Stage2Dir" - # Run tests on stage2 dotnet tools - & "$PSScriptRoot\test\runtests.ps1" - if (!$?) { - Write-Host "Command failed: $PSScriptRoot\test\runtests.ps1" - Exit 1 - } - - # Run Validation for Project.json dependencies - dotnet publish $RepoRoot\tools\MultiProjectValidator -o $Stage2Dir\..\tools - & "$Stage2Dir\..\tools\pjvalidate" "$RepoRoot\src" - # TODO For release builds, this should be uncommented and fail. - # if (!$?) { - # Write-Host "Project Validation Failed" - # Exit 1 - # } - -} finally { - $env:PATH = $StartPath - $env:DOTNET_HOME = $StartDotNetHome -} diff --git a/scripts/compile.sh b/scripts/compile.sh deleted file mode 100755 index 20d563604..000000000 --- a/scripts/compile.sh +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. -# - -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 )" - -source "$DIR/_common.sh" - -getDnx() -{ - DNX_FEED="https://api.nuget.org/packages" - DNX_VERSION="1.0.0-rc1-update1" - DNX_DIR=$OUTPUT_ROOT/dnx - - if [ "$OSNAME" == "osx" ]; then - DNX_FLAVOR="dnx-coreclr-darwin-x64" - elif [ "$OSNAME" == "ubuntu" ]; then - DNX_FLAVOR="dnx-coreclr-linux-x64" - elif [ "$OSNAME" == "centos" ]; then - # No support dnx on redhat yet. - # using patched dnx - DNX_FEED="https://dotnetcli.blob.core.windows.net/dotnet/redhat_dnx" - DNX_VERSION="1.0.0-rc2-15000" - DNX_FLAVOR="dnx-coreclr-redhat-x64" - else - error "unknown OS: $OSNAME" 1>&2 - exit 1 - fi - - header "Downloading DNX $DNX_VERSION" - DNX_URL="$DNX_FEED/$DNX_FLAVOR.$DNX_VERSION.nupkg" - DNX_ROOT="$DNX_DIR/bin" - rm -rf $DNX_DIR - mkdir -p $DNX_DIR - curl -o $DNX_DIR/dnx.zip $DNX_URL --silent - unzip -qq $DNX_DIR/dnx.zip -d $DNX_DIR - chmod a+x $DNX_ROOT/dnu $DNX_ROOT/dnx -} - -if ! type -p cmake >/dev/null; then - error "cmake is required to build the native host 'corehost'" - error "OS X w/Homebrew: 'brew install cmake'" - error "Ubuntu: 'sudo apt-get install cmake'" - exit 1 -fi - -[ -z "$CONFIGURATION" ] && export CONFIGURATION=Debug - -if [[ ! -z "$OFFLINE" ]]; then - header "Skipping Stage 0, Dnx, and Packages download: Offline Build" -else - # Download DNX to copy into stage2 - getDnx - - # Ensure the latest stage0 is installed - $DIR/install.sh - - # And put the stage0 on the PATH - export PATH=$REPOROOT/artifacts/$RID/stage0/bin:$PATH - - # Intentionally clear the DOTNET_TOOLS path, we want to use the default installed version - unset DOTNET_TOOLS - - DOTNET_PATH=$(which dotnet) - PREFIX="$(cd -P "$(dirname "$DOTNET_PATH")/.." && pwd)" - - header "Restoring packages" - $DNX_ROOT/dnu restore "$REPOROOT/src" --quiet --runtime "$RID" --no-cache - $DNX_ROOT/dnu restore "$REPOROOT/test" --quiet --runtime "$RID" --no-cache - $DNX_ROOT/dnu restore "$REPOROOT/tools" --quiet --runtime "$RID" --no-cache - set +e - $DNX_ROOT/dnu restore "$REPOROOT/testapp" --quiet --runtime "$RID" --no-cache >/dev/null 2>&1 - set -e -fi - -header "Building corehost" - -# Set up the environment to be used for building with clang. -if which "clang-3.5" > /dev/null 2>&1; then - export CC="$(which clang-3.5)" - export CXX="$(which clang++-3.5)" -elif which "clang-3.6" > /dev/null 2>&1; then - export CC="$(which clang-3.6)" - export CXX="$(which clang++-3.6)" -elif which clang > /dev/null 2>&1; then - export CC="$(which clang)" - export CXX="$(which clang++)" -else - error "Unable to find Clang Compiler" - error "Install clang-3.5 or clang3.6" - exit 1 -fi - -pushd "$REPOROOT/src/corehost" 2>&1 >/dev/null -[ -d "cmake/$RID" ] || mkdir -p "cmake/$RID" -cd "cmake/$RID" -cmake ../.. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=$CONFIGURATION -make - -# Publish to artifacts -[ -d "$HOST_DIR" ] || mkdir -p $HOST_DIR -cp "$REPOROOT/src/corehost/cmake/$RID/corehost" $HOST_DIR -popd 2>&1 >/dev/null - -# Build Stage 1 -header "Building stage1 dotnet using downloaded stage0 ..." -OUTPUT_DIR=$STAGE1_DIR $DIR/build/build-stage.sh - -# Use stage1 tools -export DOTNET_TOOLS=$STAGE1_DIR - -# Build Stage 2 -header "Building stage2 dotnet using just-built stage1 ..." -OUTPUT_DIR=$STAGE2_DIR $DIR/build/build-stage.sh - -echo "Crossgenning Roslyn compiler ..." -$REPOROOT/scripts/crossgen/crossgen_roslyn.sh "$STAGE2_DIR/bin" - -# Make Stage 2 Folder Accessible -chmod -R a+r $REPOROOT - -# Copy DNX in to stage2 -cp -R $DNX_ROOT $STAGE2_DIR/bin/dnx - -# Copy and CHMOD the dotnet-restore script -cp $DIR/dotnet-restore.sh $STAGE2_DIR/bin/dotnet-restore -chmod a+x $STAGE2_DIR/bin/dotnet-restore - -# No compile native support in centos yet -# https://github.com/dotnet/cli/issues/453 -if [ "$OSNAME" != "centos" ]; then - # Copy in AppDeps - header "Acquiring Native App Dependencies" - DOTNET_HOME=$STAGE2_DIR DOTNET_TOOLS=$STAGE2_DIR $REPOROOT/scripts/build/build_appdeps.sh "$STAGE2_DIR/bin" -fi - -# Stamp the output with the commit metadata -COMMIT_ID=$(git rev-parse HEAD) -echo $COMMIT_ID > $STAGE2_DIR/.commit - -# Skipping tests for centos -# tracked by issue - https://github.com/dotnet/corefx/issues/5066 -if [ "$OSNAME" != "centos" ]; then - # Run tests on the stage2 output - header "Testing stage2..." - DOTNET_HOME=$STAGE2_DIR DOTNET_TOOLS=$STAGE2_DIR $DIR/test/runtests.sh -fi - -# Run Validation for Project.json dependencies -dotnet publish "$REPOROOT/tools/MultiProjectValidator" -o "$STAGE2_DIR/../tools" -#TODO for release builds this should fail -set +e -"$STAGE2_DIR/../tools/pjvalidate" "$REPOROOT/src" -set -e diff --git a/scripts/compile/compile-stage.sh b/scripts/compile/compile-stage.sh index 37e2422ec..c83ce1657 100755 --- a/scripts/compile/compile-stage.sh +++ b/scripts/compile/compile-stage.sh @@ -13,7 +13,6 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli [[ "$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/_common.sh" diff --git a/scripts/dev-dotnet.sh b/scripts/dev-dotnet.sh index 087352286..e7d8e6eac 100755 --- a/scripts/dev-dotnet.sh +++ b/scripts/dev-dotnet.sh @@ -13,9 +13,8 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli [[ "$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" +source "$DIR/common/_common.sh" if [ -d "$STAGE2_DIR" ]; then PATH=$STAGE2_DIR/bin:$PATH diff --git a/scripts/docker/dockerbuild.sh b/scripts/docker/dockerbuild.sh index 893d46a95..bcee32e24 100755 --- a/scripts/docker/dockerbuild.sh +++ b/scripts/docker/dockerbuild.sh @@ -14,9 +14,9 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli done DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" -source $DIR/../common/_common.sh +source "$DIR/../common/_common.sh" -cd $DIR/../.. +cd $REPOROOT [ -z "$DOTNET_BUILD_CONTAINER_TAG" ] && DOTNET_BUILD_CONTAINER_TAG="dotnetcli-build" [ -z "$DOTNET_BUILD_CONTAINER_NAME" ] && DOTNET_BUILD_CONTAINER_NAME="dotnetcli-build-container" diff --git a/scripts/docker/dockerrun.sh b/scripts/docker/dockerrun.sh index 71a54ee6f..d388d0b1b 100755 --- a/scripts/docker/dockerrun.sh +++ b/scripts/docker/dockerrun.sh @@ -14,7 +14,7 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" source "$DIR/../_common.sh" -cd $DIR/../.. +cd $REPOROOT [ -z "$DOTNET_BUILD_CONTAINER_TAG" ] && DOTNET_BUILD_CONTAINER_TAG="dotnetcli-build" [ -z "$DOTNET_BUILD_CONTAINER_NAME" ] && DOTNET_BUILD_CONTAINER_NAME="dotnetcli-build-container" diff --git a/scripts/package/package-debian.sh b/scripts/package/package-debian.sh index 1034a0046..50c8b9252 100755 --- a/scripts/package/package-debian.sh +++ b/scripts/package/package-debian.sh @@ -16,7 +16,7 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli done DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" -source "$DIR/../_common.sh" +source "$DIR/../common/_common.sh" if [ "$UNAME" != "Linux" ]; then error "Debian Package build only supported on Linux" diff --git a/scripts/package/package-dnvm.sh b/scripts/package/package-dnvm.sh index 79c136dcb..aa873e725 100755 --- a/scripts/package/package-dnvm.sh +++ b/scripts/package/package-dnvm.sh @@ -12,16 +12,7 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli done DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" -source "$DIR/../_common.sh" - -REPOROOT="$( cd -P "$DIR/../.." && pwd )" - -if [ -z "$DOTNET_BUILD_VERSION" ]; then - TIMESTAMP=$(date "+%Y%m%d%H%M%S") - DOTNET_BUILD_VERSION=0.0.1-alpha-t$TIMESTAMP -fi - -STAGE2_DIR=$REPOROOT/artifacts/$RID/stage2 +source "$DIR/../common/_common.sh" if [ ! -d "$STAGE2_DIR" ]; then error "missing stage2 output in $STAGE2_DIR" 1>&2 @@ -44,4 +35,4 @@ tar -czf $PACKAGE_NAME * .version info "Packaged stage2 to $PACKAGE_NAME" -$DIR/../publish/publish.sh $PACKAGE_NAME +$REPOROOT/scripts/publish/publish.sh $PACKAGE_NAME diff --git a/scripts/package/package.sh b/scripts/package/package.sh index 0c504d1a2..40d9f9074 100755 --- a/scripts/package/package.sh +++ b/scripts/package/package.sh @@ -14,8 +14,6 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" source "$DIR/../common/_common.sh" -REPOROOT="$( cd -P "$DIR/../.." && pwd )" - if [ -z "$DOTNET_BUILD_VERSION" ]; then TIMESTAMP=$(date "+%Y%m%d%H%M%S") DOTNET_BUILD_VERSION=0.0.1-alpha-t$TIMESTAMP @@ -44,4 +42,4 @@ tar -czf $PACKAGE_NAME * .version info "Packaged stage2 to $PACKAGE_NAME" -$DIR/../publish/publish.sh $PACKAGE_NAME +$REPOROOT/scripts/publish/publish.sh $PACKAGE_NAME diff --git a/scripts/publish/publish.sh b/scripts/publish/publish.sh index e448b39e9..574c63b47 100755 --- a/scripts/publish/publish.sh +++ b/scripts/publish/publish.sh @@ -18,10 +18,11 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli 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 -SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" -REPOROOT="$( cd -P "$SCRIPT_DIR/../.." && pwd )" +DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" -source "$SCRIPT_DIR/../common/_common.sh" +source "$DIR/../common/_common.sh" + +SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" UPLOAD_FILE=$1 UPLOAD_JSON_FILE="package_upload.json"