Skip to content

Commit

Permalink
Merge pull request #17821 from github/criemen/win-make-bazel
Browse files Browse the repository at this point in the history
Go: Fix makefile to use bash to look up bazel path.
  • Loading branch information
criemen authored Oct 22, 2024
2 parents 60c205f + 1ccadbc commit cdffa09
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions go/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 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 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 on CI.
BAZEL := $(shell bash -c "which bazel")

all: gen extractor

EXTRACTOR_PACK_OUT = extractor-pack
Expand Down Expand Up @@ -28,10 +35,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 +55,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 cdffa09

Please sign in to comment.