Skip to content

Commit eadd57d

Browse files
jDramaixcopybara-github
authored andcommitted
Update Bazel instructions in README to use Bazel Modules.
Also removes an obsolete section about downloading the generator. PiperOrigin-RevId: 793783887
1 parent 21ccd00 commit eadd57d

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

README.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,24 @@ Any other uses are experimental. You can use it to generate java APIs for other
88

99
Run with Bazel
1010
---------------
11-
If your project uses [Bazel](https://bazel.build). You can use `jsinterop_generator` rule to generate java code.
11+
Using Bazel 8 or later, add to your `MODULE.bazel` file:
1212

13-
You need to add this repository as an external dependency in your `WORKSPACE` file
13+
```starlark
14+
bazel_dep(name = "jsinterop_generator", version = "<RELEASE_VERSION>")
15+
```
1416

15-
new_http_archive(
16-
name = "com_google_jsinterop_generator",
17-
url="https://github.com/google/jsinterop-generator/archive/master.zip",
18-
strip_prefix="jsinterop-generator-master",
19-
)
17+
Replace `RELEASE_VERSION` with an actual [release version](https://github.com/google/jsinterop-generator/releases).
2018

21-
and then define a `jsinterop_generator` target in your 'BUILD' file
19+
Then, in your `BUILD` file, load the generator rule and use it:
2220

23-
load("@com_google_jsinterop_generator//:jsinterop_generator.bzl", "jsinterop_generator")
21+
```bzl
22+
load("@jsinterop_generator//:jsinterop_generator.bzl", "jsinterop_generator")
2423

25-
jsinterop_generator(
24+
jsinterop_generator(
2625
name = "my_thirdparty_lib",
2726
srcs = ["my_externs.js"],
28-
)
27+
)
28+
```
2929

3030
You can now directly depend on `:my_thirdparty_lib` target in your `java_library` rules or build the jar files with `bazel build //path/to/your/BUILD/file/directory:my_thirdparty_lib`.
3131
The jar files with the generated source will created in `bazel-bin/path/to/your/BUILD/file/directory`.
@@ -53,9 +53,6 @@ Run as a standalone java program
5353

5454
The generated jar file can be found at `bazel-bin/java/jsinterop/generator/closure/ClosureJsinteropGenerator_deploy.jar`
5555

56-
### Or download the generator
57-
TODO(dramaix): provides link to download the generator.
58-
5956
### Run the generator
6057
Now you have the jar file, just invoke
6158

0 commit comments

Comments
 (0)