diff options
author | Yun Peng <pcloudy@google.com> | 2016-09-15 16:30:52 +0000 |
---|---|---|
committer | Dmitry Lomov <dslomov@google.com> | 2016-09-16 07:58:47 +0000 |
commit | 5d03c5c03b1f3d1e7841fac05e55ee33e6907c3e (patch) | |
tree | 1cc8334828b312f80c5514ff36cc0df0746801a3 /tools/cpp | |
parent | df960c22f2ba057fc389ebeb6a20d5035efeb6ef (diff) |
Checking BAZEL_SH first when looking for bash on Windows
In case cc_configure finds the wrong bash binary if user is running Windows 10 with bash on Windows.
This should help https://github.com/bazelbuild/bazel/issues/1453
--
Change-Id: Iffd365e3e2dd2389882390dffdf6f3a88719530e
Reviewed-on: https://bazel-review.googlesource.com/#/c/6072
MOS_MIGRATED_REVID=133270634
Diffstat (limited to 'tools/cpp')
-rw-r--r-- | tools/cpp/cc_configure.bzl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/cpp/cc_configure.bzl b/tools/cpp/cc_configure.bzl index 13c027b5b0..559b928887 100644 --- a/tools/cpp/cc_configure.bzl +++ b/tools/cpp/cc_configure.bzl @@ -373,14 +373,21 @@ def _find_python(repository_ctx): """Find where is python on Windows.""" if "BAZEL_PYTHON" in repository_ctx.os.environ: return repository_ctx.os.environ["BAZEL_PYTHON"] - auto_configure_warning("'BAZEL_PYTHON' is not set, start finding python in PATH.") + auto_configure_warning("'BAZEL_PYTHON' is not set, start looking for python in PATH.") python_binary = _which_cmd(repository_ctx, "python.exe", "C:\\Python27\\python.exe") return python_binary +def _find_bash(repository_ctx): + """Find where is bash on Windows.""" + if "BAZEL_SH" in repository_ctx.os.environ: + return repository_ctx.os.environ["BAZEL_SH"] + auto_configure_warning("'BAZEL_SH' is not set, start looking for bash in PATH.") + bash_binary = _which_cmd(repository_ctx, "bash.exe") + return bash_binary def _find_vs_path(repository_ctx): """Find Visual Studio install path.""" - bash_bin = _which_cmd(repository_ctx, "bash.exe") + bash_bin = _find_bash(repository_ctx) program_files_dir = _get_env_var(repository_ctx, "ProgramFiles(x86)", "C:\\Program Files (x86)") vs_version = _execute(repository_ctx, [bash_bin, "-c", "ls '%s' | grep -E 'Microsoft Visual Studio [0-9]+' | sort | tail -n 1" % program_files_dir]) return program_files_dir + "/" + vs_version |