Skip to content

Commit 5c7674c

Browse files
Merge pull request #20 from davido:extend_readme_for_update_instruction
PiperOrigin-RevId: 274961218 Change-Id: I6ef304dd525ab15c8f5d3deea1422706475f9c4a
2 parents 4587311 + 350c578 commit 5c7674c

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,50 @@ The source code of the Bazel Tools for Java is currently checked in the [bazel
66
repository](https://github.com/bazelbuild/bazel). The source code will be moved
77
incrementally to this repository.
88

9+
# Upgrade a Bazel project to use custom java_tools version
10+
11+
To use a specific java_tools release in your Bazel project please add the `http_archive`
12+
definitions in your WORKSPACE file and set the options `--java_toolchain` and/or
13+
`--host_java_toolchain` accordingly. All java_tools releases can be found under
14+
https://github.com/bazelbuild/java_tools/releases.
15+
16+
For example to use java_tools_javac11-v6.0 you can add the following to the WORKSPACE
17+
file:
18+
19+
```
20+
http_archive(
21+
name = "remote_java_tools_linux",
22+
sha256 = "37acb8380b1dd6c31fd27a19bf3da821c9b02ee93c6163fce36f070a806516b5",
23+
urls = [
24+
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.0/java_tools_javac11_linux-v6.0.zip",
25+
"https://github.com/bazelbuild/java_tools/releases/download/javac11-v6.0/java_tools_javac11_linux-v6.0.zip",
26+
],
27+
)
28+
http_archive(
29+
name = "remote_java_tools_windows",
30+
sha256 = "384e138ca58842ea563fb7efbe0cb9c5c381bd4de1f6a31f0256823325f81ccc",
31+
urls = [
32+
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.0/java_tools_javac11_windows-v6.0.zip",
33+
"https://github.com/bazelbuild/java_tools/releases/download/javac11-v6.0/java_tools_javac11_windows-v6.0.zip",
34+
],
35+
)
36+
http_archive(
37+
name = "remote_java_tools_darwin",
38+
sha256 = "5a9f320c33424262e505151dd5c6903e36678a0f0bbdaae67bcf07f41d8c7cf3",
39+
urls = [
40+
"https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.0/java_tools_javac11_darwin-v6.0.zip",
41+
"https://github.com/bazelbuild/java_tools/releases/download/javac11-v6.0/java_tools_javac11_darwin-v6.0.zip",
42+
],
43+
)
44+
```
45+
46+
and set the command line options according to the OS:
47+
48+
```
49+
--java_toolchain=@remote_java_tools_linux//:toolchain \
50+
--host_java_toolchain=@remote_java_tools_linux//:toolchain
51+
```
52+
953
# Releases
1054

1155
The releases can be found under [java_tools/releases](https://github.com/bazelbuild/java_tools/releases)

0 commit comments

Comments
 (0)