Search code examples
bazel

Why won't Bazel creating symlinks during the build process?


From the directory with the WORKSPACE file I'm building a java target in bazel that should leave all the symlinks:

bazel build --symlink_prefix=bazel --experimental_convenience_symlinks=ignore //path/to/dir:JavaTarget

but it won't create the symlinks. I've removed the .bazelrc file and set the current and parent directories to chmod 777. I can't figure out why it isn't creating the links.


Solution

  • The documentation for --experimental_convenience_symlinks=ignore says:

    "ignore: Symlinks will be left alone"

    https://bazel.build/reference/command-line-reference#flag--experimental_convenience_symlinks

    But the source code says something more specific:

        /** Will not create or clean up any symlinks. */
        IGNORE,
    

    https://github.com/bazelbuild/bazel/blob/38ade70fed4b34043d21a606717ad2ed1ee9c696/src/main/java/com/google/devtools/build/lib/buildtool/BuildRequestOptions.java#L506-L507

    So try not specifying --experimental_convenience_symlinks to leave it at the default value of normal.