prevent sourced files from leaking unintended state to callers

This commit is contained in:
Piotr Puszkiewicz 2015-12-29 12:40:39 -08:00
parent e91db7dce1
commit 9df40f9c01
2 changed files with 9 additions and 10 deletions

View file

@ -8,3 +8,5 @@
LAST_COMMIT_TIMESTAMP=$(git log -1 --format=%ct)
export DOTNET_BUILD_VERSION=1.0.0-dev-$LAST_COMMIT_TIMESTAMP
echo "Version: $DOTNET_BUILD_VERSION"
unset LAST_COMMIT_TIMESTAMP

View file

@ -9,15 +9,15 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
COMMONSOURCE="$(readlink "$COMMONSOURCE")"
[[ $COMMONSOURCE != /* ]] && COMMONSOURCE="$COMMONDIR/$COMMONSOURCE" # 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 "$COMMONSOURCE" )" && pwd )"
COMMONDIR="$( cd -P "$( dirname "$COMMONSOURCE" )" && pwd )"
source "$DIR/_clang.sh"
source "$DIR/_prettyprint.sh"
source "$DIR/_rid.sh"
source "$COMMONDIR/_clang.sh"
source "$COMMONDIR/_prettyprint.sh"
source "$COMMONDIR/_rid.sh"
# TODO: Replace this with a dotnet generation
export TFM=dnxcore50
export REPOROOT=$(cd $DIR/../.. && pwd)
export REPOROOT=$(cd $COMMONDIR/../.. && pwd)
export OUTPUT_ROOT=$REPOROOT/artifacts/$RID
export DNX_DIR=$OUTPUT_ROOT/dnx
export DNX_ROOT=$DNX_DIR/bin
@ -30,8 +30,5 @@ export HOST_DIR=$OUTPUT_ROOT/corehost
[ -z "$DOTNET_HOME" ] && export DOTNET_HOME=$STAGE2_DIR && export PATH=$STAGE2_DIR/bin:$PATH
[ -z "$CONFIGURATION" ] && export CONFIGURATION=Debug
# if the conditional set is the last command in this file AND
# the condition is false then the program exits here. Seems like
# a bug in BASH... or indication that there is more to learn about Linux
# the below line is a hack that works around this issue
a=1+1
unset COMMONSOURCE
unset COMMONDIR