Skip to content

Commit cdffa09

Browse files
authored
Merge pull request github#17821 from github/criemen/win-make-bazel
Go: Fix makefile to use bash to look up bazel path.
2 parents 60c205f + 1ccadbc commit cdffa09

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

go/Makefile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# On Windows, make's path resolution algorithm is incorrect. It picks up a bazel.exe in PATH that's
2+
# after a bazel binary. In particular, on actions, the non-exe binary is a bazelisk instance, whereas
3+
# bazel.exe is a bazel installation.
4+
# This means we pick up the wrong bazel version, and if the differences between the bazel we want
5+
# and that we actually get are too big, the build fails on CI.
6+
BAZEL := $(shell bash -c "which bazel")
7+
18
all: gen extractor
29

310
EXTRACTOR_PACK_OUT = extractor-pack
@@ -28,10 +35,10 @@ qhelp-to-markdown:
2835
scripts/qhelp-to-markdown.sh ql/src "$(QHELP_OUT_DIR)"
2936

3037
extractor:
31-
bazel run :go-installer
38+
$(BAZEL) run :go-installer
3239

3340
gen:
34-
bazel run :gen
41+
$(BAZEL) run :gen
3542

3643
build/stats/src.stamp:
3744
mkdir -p $(@D)/src
@@ -48,7 +55,7 @@ test: all build/testdb/check-upgrade-path
4855
codeql test run -j0 ql/test --search-path .. --consistency-queries ql/test/consistency --compilation-cache=$(cache)
4956
# use GOOS=linux because GOOS=darwin GOARCH=386 is no longer supported
5057
env GOOS=linux GOARCH=386 codeql$(EXE) test run -j0 ql/test/query-tests/Security/CWE-681 --search-path .. --consistency-queries ql/test/consistency --compilation-cache=$(cache)
51-
cd extractor; bazel test ...
58+
cd extractor; $(BAZEL) test ...
5259
bash extractor-smoke-test/test.sh || (echo "Extractor smoke test FAILED"; exit 1)
5360

5461
.PHONY: build/testdb/check-upgrade-path

0 commit comments

Comments
 (0)