Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Collect generates source as well as dependency information #15

Merged
merged 3 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Once this is completed, add this to your `.bazelrc`:
build --extra_toolchains=@bazel_jdt_java_toolchain//jdt:all
```

By default the `jdt_java_toolchain` is using `local_jdk` for compilation.
By default the `jdt_java_toolchain` is using `local_jdk` for compilation.
Please create your own `default_java_toolchain` if this doesn't work for your use case.

Have a look at `jdt/BUILD` to see which JDKs are supported.
Expand All @@ -35,17 +35,18 @@ and point directly at the source of this repo for development and testing.

Unfortunately this means additional steps are required for developers. This script can be
used to facilitate the steps.

```
#!/bin/bash

bazel build :JdtJavaBuilder_deploy.jar
cp -fv bazel-bin/JdtJavaBuilder_deploy.jar compiler/export/

bazel build //compiler/third_party/turbine:turbine_direct_binary_deploy.jar
bazel build //compiler/third_party/turbine:turbine_direct_binary_deploy.jar
cp -fv bazel-bin/compiler/third_party/turbine/turbine_direct_binary_deploy.jar compiler/tools/
```

For your convinience, the `build-toolchain` script is provided in this repository.
For your convenience, the `build-toolchain` script is provided in this repository.


## Debugging
Expand Down Expand Up @@ -85,8 +86,8 @@ ERROR: /Users/username/app/main/core/some-java-target/BUILD.bazel:4:13: Building
/Users/username/tools/Darwin/jdk/bin/java -jar external/jdt_java_toolchain/builder/export/JdtJavaBuilder_deploy.jar @bazel-out/darwin-fastbuild/bin/some-java-target/libtarget-class.jar-0.params @bazel-out/darwin-fastbuild/bin/some-java-target/libtarget-class.jar-1.params)
```

Either take the *SUBCOMMAND* or *ERROR* command.
You can ignore the `exec env` part.
Either take the *SUBCOMMAND* or *ERROR* command.
You can ignore the `exec env` part.

The interesting two steps are:

Expand All @@ -99,7 +100,7 @@ cd /private/var/tmp/_bazel_username/hash/execroot/core
```

The first is the execution directory and the latter the command.
You need to cd into the execution directory and then run the command yourself.
You need to `cd` into the execution directory and then run the command yourself.
But this time add the remote debug arguments (before `-jar`) as follows:

```
Expand All @@ -120,3 +121,4 @@ The VS Code Bazel Java extension should also work.
## Releasing

See [RELEASING README](dist/README.md).

8 changes: 8 additions & 0 deletions compiler/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ java_library(
"@rules_jdt_org_ow2_asm_asm_commons",
"@rules_jdt_org_ow2_asm_asm_tree",
],
javacopts = [
"--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.resources=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
],
visibility = ["//:__subpackages__"],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public JavaLibraryBuildRequest(
this.processingModule = processingBuilder.build();

ImmutableList.Builder<BlazeJavaCompilerPlugin> pluginsBuilder =
ImmutableList.<BlazeJavaCompilerPlugin>builder();//.add(dependencyModule.getPlugin());
ImmutableList.<BlazeJavaCompilerPlugin>builder().add(dependencyModule.getPlugin());
processingModule.registerPlugin(pluginsBuilder);
pluginsBuilder.addAll(extraPlugins);
this.plugins = pluginsBuilder.build();
Expand Down
Loading