Skip to content

Commit

Permalink
* merge activate and bootstrap (#3311)
Browse files Browse the repository at this point in the history
* run activate in an external env from the Xcode connector
* fix pip install nits
* fix mismerge, set CHIP_ROOT unconditionally
* use better names than updirs, lookinfer
  • Loading branch information
Rob Walker authored and pull[bot] committed Nov 20, 2020
1 parent 9014720 commit b36ccd2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ EOF
local _SETUP_SH="$_PW_ACTUAL_ENVIRONMENT_ROOT/activate.sh"

export PW_DOCTOR_SKIP_CIPD_CHECKS=1
export PATH # https://bugs.chromium.org/p/pigweed/issues/detail?id=281

if [ "$_BOOTSTRAP_NAME" = "bootstrap.sh" ] ||
[ ! -f "$_SETUP_SH" ] ||
Expand Down
27 changes: 24 additions & 3 deletions src/darwin/Framework/chip_xcode_build_connector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,35 @@ fi
)
}

find_in_ancestors() {
declare to_find="${1}"
declare dir="${2:-$(pwd)}"

while [[ ! -e ${dir}/${to_find} && -n ${dir} ]]; do
dir=${dir%/*}
done

if [[ ! -e ${dir}/${to_find} ]]; then
printf 'error: find_in_ancestors: %s not found\n' "$to_find" >&2
return 1
fi
printf '%s\n' "$dir/$to_find"
}

(
cd "$CHIP_ROOT" # pushd and popd because we need the env vars from activate

if ENV=$(find_in_ancestors chip_xcode_build_connector_env.sh 2>/dev/null); then
. "$ENV"
fi

[[ -n $CHIP_NO_SUBMODULES ]] || git submodule update --init
if [[ -z $CHIP_NO_ACTIVATE ]]; then
# first run bootstrap in an external env to build everything
env -i PW_ENVSETUP_NO_BANNER=1 PW_ENVSETUP_QUIET=1 bash -c '. scripts/activate.sh'
set +ex
echo PW_ENVSETUP_QUIET=1 . scripts/activate.sh >&2
PW_ENVSETUP_QUIET=1 . scripts/activate.sh
(($? != 0)) && echo "Please source $CHIP_ROOT/scripts/bootstrap.sh before building" && exit 1
# now source activate for env vars
PW_ENVSETUP_NO_BANNER=1 PW_ENVSETUP_QUIET=1 . scripts/activate.sh
set -ex
fi

Expand Down

0 comments on commit b36ccd2

Please sign in to comment.