diff options
Diffstat (limited to 'scripts/bootstrap')
-rwxr-xr-x | scripts/bootstrap/buildenv.sh | 12 | ||||
-rwxr-xr-x | scripts/bootstrap/compile.sh | 16 |
2 files changed, 27 insertions, 1 deletions
diff --git a/scripts/bootstrap/buildenv.sh b/scripts/bootstrap/buildenv.sh index 8dfb6fe917..0689b95919 100755 --- a/scripts/bootstrap/buildenv.sh +++ b/scripts/bootstrap/buildenv.sh @@ -301,3 +301,15 @@ function get_bind_target() { $BAZEL --bazelrc=${BAZELRC} --nomaster_bazelrc ${BAZEL_DIR_STARTUP_OPTIONS} \ query "deps($1, 1) - $1" } + +# Create a link for a directory on the filesystem +function link_dir() { + local source=$1 + local dest=$2 + + if [[ "${PLATFORM}" == "windows" ]]; then + cmd.exe /C "mklink /J \"$(cygpath -w "$dest")\" \"$(cygpath -w "$source")\"" + else + ln -s "${source}" "${dest}" + fi +} diff --git a/scripts/bootstrap/compile.sh b/scripts/bootstrap/compile.sh index f991e32a22..2ae26f44bd 100755 --- a/scripts/bootstrap/compile.sh +++ b/scripts/bootstrap/compile.sh @@ -207,10 +207,24 @@ if [ -z "${BAZEL_SKIP_JAVA_COMPILATION}" ]; then cp src/main/java/$i ${OUTPUT_DIR}/classes/$i done + # Create the bazel_tools repository. + BAZEL_TOOLS_REPO=${OUTPUT_DIR}/embedded_tools + mkdir -p ${BAZEL_TOOLS_REPO} + cat <<EOF >${BAZEL_TOOLS_REPO}/WORKSPACE +workspace(name = 'bazel_tools') +EOF + link_dir ${PWD}/src ${BAZEL_TOOLS_REPO}/src + link_dir ${PWD}/third_party ${BAZEL_TOOLS_REPO}/third_party + link_dir ${PWD}/tools ${BAZEL_TOOLS_REPO}/tools + + # Set up @bazel_tools//platforms properly + mkdir -p ${BAZEL_TOOLS_REPO}/platforms + cp tools/platforms/platforms.BUILD ${BAZEL_TOOLS_REPO}/platforms/BUILD + # Overwrite tools.WORKSPACE, this is only for the bootstrap binary chmod u+w "${OUTPUT_DIR}/classes/com/google/devtools/build/lib/bazel/rules/tools.WORKSPACE" cat <<EOF >${OUTPUT_DIR}/classes/com/google/devtools/build/lib/bazel/rules/tools.WORKSPACE -local_repository(name = 'bazel_tools', path = __workspace_dir__) +local_repository(name = 'bazel_tools', path = '${BAZEL_TOOLS_REPO}') bind(name = "cc_toolchain", actual = "@bazel_tools//tools/cpp:default-toolchain") EOF |