我挖掘了选项和源代码,但仍然不确定如何调试 bazel 构建,特别是 java。
也有人知道我如何更改 bazel,在本地构建它并在构建时使用它来验证。我找到了 bazel 调用: exec -a "$0" "${BAZEL_REAL}" "$@"
其中 BAZEL_REAL 是二进制文件:/usr/local/Cellar/bazel/0.15.2/libexec/bin/bazel-real
但这并没有详细解释它是如何开始的以及我如何调试它......
就像在构建我的代码时可以跳入和调试 com.google.devtools.build.lib.bazel.rules.java.BazelJavaLibraryRule 一样吗?就像我用 Maven 构建代码一样,我可以做 mvnDebug。
bazel build -s
➜ bazel git:(master) ✗ bazel build //examples/java-native/src/main/java/com/example/myproject:hello-world -s
BAZEL_REAL==/usr/local/Cellar/bazel/0.15.2/libexec/bin/bazel-real
INFO: Analysed target //examples/java-native/src/main/java/com/example/myproject:hello-world (15 packages loaded).
INFO: Found 1 target...
Target //examples/java-native/src/main/java/com/example/myproject:hello-world up-to-date:
bazel-bin/examples/java-native/src/main/java/com/example/myproject/hello-world.jar
bazel-bin/examples/java-native/src/main/java/com/example/myproject/hello-world
INFO: Elapsed time: 4.943s, Critical Path: 0.29s
INFO: 0 processes.
INFO: Build completed successfully, 2 total actions