Noel Yap
Noel Yap

Reputation: 19788

Why is BUILD_WORKSPACE_DIRECTORY not getting set?

I'm using bazel 5.1.0 and have the following in a BUILD file:

sh_binary(
    name = "aoeu",
    srcs = ["aoeu.sh"]
)

The contents of aoeu.sh is:

#!/bin/bash

echo "BAZEL_WORKSPACE_DIRECTORY=${BAZEL_WORKSPACE_DIRECTORY}"

When I bazel run aoeu, the output is BAZEL_WORKSPACE_DIRECTORY=.

Based on https://docs.bazel.build/versions/main/user-manual.html, my understanding is that BAZEL_WORKSPACE_DIRECTORY should be set. Why isn't it?

Upvotes: 1

Views: 1570

Answers (1)

Benjamin Peterson
Benjamin Peterson

Reputation: 20530

The desired environmental variable is called BUILD_WORKSPACE_DIRECTORY not BAZEL_WORKSPACE_DIRECTORY.

Upvotes: 3

Related Questions