Skip to content

Commit 0bc50ca

Browse files
committed
Allow overriding tools/bazel path with BAZELISK_WRAPPER_PATH
In some projects the tools/bazel path isn't practical. This allows users to override this path with the BAZELISK_WRAPPER_PATH env var / .bazeliskrc config option.
1 parent 24935f4 commit 0bc50ca

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

core/core.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ import (
3333
)
3434

3535
const (
36-
bazelReal = "BAZEL_REAL"
37-
skipWrapperEnv = "BAZELISK_SKIP_WRAPPER"
38-
wrapperPath = "./tools/bazel"
39-
maxDirLength = 255
36+
bazelReal = "BAZEL_REAL"
37+
skipWrapperEnv = "BAZELISK_SKIP_WRAPPER"
38+
defaultWrapperPath = "./tools/bazel"
39+
maxDirLength = 255
4040
)
4141

4242
var (
@@ -496,6 +496,11 @@ func maybeDelegateToWrapperFromDir(bazel string, wd string, config config.Config
496496
return bazel
497497
}
498498

499+
wrapperPath := config.Get("BAZELISK_WRAPPER_PATH")
500+
if wrapperPath == "" {
501+
wrapperPath = defaultWrapperPath
502+
}
503+
499504
root := ws.FindWorkspaceRoot(wd)
500505
wrapper := filepath.Join(root, wrapperPath)
501506
if stat, err := os.Stat(wrapper); err == nil && !stat.Mode().IsDir() && stat.Mode().Perm()&0111 != 0 {

0 commit comments

Comments
 (0)