Skip to content

Commit

Permalink
Build script fixes for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dsplaisted committed Nov 8, 2018
1 parent 3604112 commit 9bdfb5a
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 381 deletions.
8 changes: 6 additions & 2 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@echo off
powershell -NoLogo -NoProfile -ExecutionPolicy ByPass -Command "& """%~dp0eng\common\build.ps1""" -build -restore %*"
exit /b %ErrorLevel%

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 -ExecutionPolicy Bypass -NoProfile -NoLogo -Command "& \"%~dp0run-build.ps1\" %*; exit $LastExitCode;"
if %errorlevel% neq 0 exit /b %errorlevel%
53 changes: 48 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,54 @@
#!/bin/bash
#!/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 OFFLINE environment variable to build offline

set -e

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
ScriptRoot="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$ScriptRoot/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
[[ "$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 )"

# Some things depend on HOME and it may not be set. We should fix those things, but until then, we just patch a value in
if [ -z "$HOME" ]; then
export HOME=$DIR/artifacts/home

[ ! -d "$HOME" ] || rm -Rf $HOME
mkdir -p $HOME
fi

args=

while [[ $# > 0 ]]; do
lowerI="$(echo $1 | awk '{print tolower($0)}')"
case $lowerI in
--docker)
export BUILD_IN_DOCKER=1
export DOCKER_IMAGENAME=$2
shift
;;
*)
args="$args $1"
;;
esac
shift
done
ScriptRoot="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

. "$ScriptRoot/eng/common/build.sh" --build --restore "$@"
dockerbuild()
{
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/run-build.sh $args
fi
54 changes: 0 additions & 54 deletions old/build.sh

This file was deleted.

118 changes: 0 additions & 118 deletions old/run-build.ps1

This file was deleted.

Loading

0 comments on commit 9bdfb5a

Please sign in to comment.