Skip to content

Commit ad1ef65

Browse files
committed
Go: Fix makefile to use bash to look up bazel path.
On Windows, make's path resolution algorithm is incorrect. It picks up a bazel.exe in PATH that's _after_ a bazel binary. In particular, on actions, the non-exe binary is a bazelisk instance, whereas bazel.exe is a bazel (at the current time 7.3.2) installation. This means we pick up the wrong bazel version, and if the differences between the bazel we want and that we actually get are too big, the build fails.
1 parent 60c205f commit ad1ef65

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

go/Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
BAZEL := $(shell bash -c "which bazel")
2+
13
all: gen extractor
24

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

3032
extractor:
31-
bazel run :go-installer
33+
$(BAZEL) run :go-installer
3234

3335
gen:
34-
bazel run :gen
36+
$(BAZEL) run :gen
3537

3638
build/stats/src.stamp:
3739
mkdir -p $(@D)/src
@@ -48,7 +50,7 @@ test: all build/testdb/check-upgrade-path
4850
codeql test run -j0 ql/test --search-path .. --consistency-queries ql/test/consistency --compilation-cache=$(cache)
4951
# use GOOS=linux because GOOS=darwin GOARCH=386 is no longer supported
5052
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 ...
53+
cd extractor; $(BAZEL) test ...
5254
bash extractor-smoke-test/test.sh || (echo "Extractor smoke test FAILED"; exit 1)
5355

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

0 commit comments

Comments
 (0)