我研究了选项和源代码,但仍然不确定如何调试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
答案 0 :(得分:3)
没关系,https://www.bazel.build/contributing.html#setting-up-your-coding-environment拥有我需要的信息。
基本上是入门版
bazel --host_jvm_debug build //:*
args的顺序很重要。例如,下面将不起作用
bazel build //:* --host_jvm_debug
要调试工作人员的jvm,请使用bazel build -s获取该命令,然后附加远程调试启动选项。