Skip to content

Commit

Permalink
Go: Fix makefile to use bash to look up bazel path.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
criemen committed Oct 22, 2024
1 parent 60c205f commit ad1ef65
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions go/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
BAZEL := $(shell bash -c "which bazel")

all: gen extractor

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

extractor:
bazel run :go-installer
$(BAZEL) run :go-installer

gen:
bazel run :gen
$(BAZEL) run :gen

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

.PHONY: build/testdb/check-upgrade-path
Expand Down

0 comments on commit ad1ef65

Please sign in to comment.