pax_global_header00006660000000000000000000000064146211433170014514gustar00rootroot0000000000000052 comment=b9e915460c7d1c2b4fcf7fef5317e10953310091 java_tools-java_13.6.1/000077500000000000000000000000001462114331700147465ustar00rootroot00000000000000java_tools-java_13.6.1/.github/000077500000000000000000000000001462114331700163065ustar00rootroot00000000000000java_tools-java_13.6.1/.github/ISSUE_TEMPLATE/000077500000000000000000000000001462114331700204715ustar00rootroot00000000000000java_tools-java_13.6.1/.github/ISSUE_TEMPLATE/release.md000066400000000000000000000005771462114331700224440ustar00rootroot00000000000000--- name: 'Release tracker' about: Use this template to request for a new java_tools release title: 'Release: java_tools vX.Y.Z' labels: ['release','P1'] assignees: - iancha1992 - sgowroji --- **Link to relevant issue and/or commit:** **Other details:** cc @bazelbuild/triage java_tools-java_13.6.1/AUTHORS000066400000000000000000000004611462114331700160170ustar00rootroot00000000000000# This the official list of Bazel authors for copyright purposes. # This file is distinct from the CONTRIBUTORS files. # See the latter for an explanation. # Names should be added to this file as: # Name or Organization # The email address is not required for organizations. Google Inc. java_tools-java_13.6.1/BUILD000066400000000000000000000001501462114331700155240ustar00rootroot00000000000000package(default_visibility = ["//visibility:public"]) licenses(["notice"]) exports_files(["LICENSE"]) java_tools-java_13.6.1/LICENSE000066400000000000000000000261361462114331700157630ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. java_tools-java_13.6.1/README.md000066400000000000000000000022401462114331700162230ustar00rootroot00000000000000# Bazel Tools for Java This is a repository for the tools used by [Bazel](https://bazel.build/) to compile Java. The source code of the Bazel Tools for Java is currently checked in the [bazel repository](https://github.com/bazelbuild/bazel). The source code will be moved incrementally to this repository. # Upgrade a Bazel project to use custom java_tools version To use a specific java_tools release in your Bazel project please add the `http_archive` definitions in your WORKSPACE file. For Bazel versions above 4.0.0, use java_tools releases >= v11. No additional options are needed. For Bazel versions <= 4.0.0 use java_tools releases <= v10 and set the options `--java_toolchain` and/or `--host_java_toolchain` accordingly. All java_tools releases can be found under https://github.com/bazelbuild/java_tools/releases. # Releases The releases can be found under [java_tools/releases](https://github.com/bazelbuild/java_tools/releases). For previous releases see the issues marked with [the release label](https://github.com/bazelbuild/java_tools/issues?q=label%3Arelease/15). If you're interested in the release process please see [docs/release.md](docs/release.md) java_tools-java_13.6.1/docs/000077500000000000000000000000001462114331700156765ustar00rootroot00000000000000java_tools-java_13.6.1/docs/behind-the-release.md000066400000000000000000000153611462114331700216530ustar00rootroot00000000000000# Behind the Release Process ## What is a `java_tools` zip? A `java_tools` zip is an archive that contains the tools required by Bazel for building Java targets (e.g. `JavaBuilder`, `Turbine`, `TestRunner`, `ijar`, `singlejar`, `javac`). Each tool, except `ijar`, `singlejar` and `javac`, are built from bazel @ HEAD and their deploy jars are archived in `java_tools.zip`. These deploy jars are platform independent. `ijar` and `singlejar` are C++ binaries which are also built from bazel @ HEAD. The built binaries accompanied by their sources are archived into the `java_tools` zip. The C++ binaries are platform dependent. `java_tools` archive two javac jars: `java_compiler.jar` and `jdk_compiler.jar`. ## How is a java_tools zip versioned and named? ### javac version The javac version archived into a `java_tools` zip is reflected in the zip’s name. For example if a `java_tools` zip contains `java_compiler.jar` and `jdk_compiler.jar` compiled for javac 9, the `java_tools` name contains `javac9`. ### platform name The `java_tools` zip is built individually for every supported platform (Ubuntu, Windows, MacOS) because the ijar and singlejar C++ binaries are platform dependent. The platform name is reflected into a `java_tools` version. For example a `java_tools` zip with binaries built on Windows contains `windows` in its name. ### version A `java_tools` zip has multiple versions for a certain javac version and platform. A new `java_tools` version is released when a new feature/bug fix is added. The version is reflected in the release name. For example the first version contains `v1.0` and a patch release version can be `v3.2`. ## Supported javac versions Currently there are `java_tools` releases with embedded `javac` 9, 10, 11, 12. ## Testing java_tools before the release process Each `java_tools` zip contains a `java_toolchain` (`//:toolchain`) in its `BUILD` file. There are java integration tests that run bazel with `--java_toolchain` and `--host_java_toolchain` pointing to a `java_tools` zip built at HEAD for each supported javac version. The tests are defined in [src/test/shell/bazel/BUILD](https://github.com/bazelbuild/bazel/blob/master/src/test/shell/bazel/BUILD) (`bazel_java_test_jdk` + `$java_version` + `toolchain_head`). The tests run on Bazel’s CI presubmit and postbumit. ## Manually trying out java_tools before the release process Build a `java_tools` zip with version *X* by running ``` bazel build //src:java_tools_javaX.zip ``` Define a repository named `local_java_tools` that points to the built zip. For example: ``` http_archive( name = "local_java_tools", urls = ["file///path/to/the/java_tools/zip"] ) ``` Build any java target pointing `--java_toolchain/--host_java_toolchain` to `@local_java_tools//:toolchain`. ## java_tools binaries pipeline The [java_tools binaries pipeline](https://buildkite.com/bazel-trusted/java-tools-binaries-java) is a Bazel’s Buildkite trusted pipeline. One needs special permission to access it. If you want to release the Java tools but don’t have these permissions please contact the Bazel EngProd team (`bazel-engprod@google.com`). The configuration file is [`java_tools-binaries.yml`](https://github.com/bazelbuild/continuous-integration/blob/master/pipelines/java_tools-binaries.yml) and is maintained by Bazel’s EngProd team. Once triggered the pipeline starts independent builds on 3 platforms: Centos7, Windows 10 and MacOS. Each platform build invokes [`src/upload_all_java_tools.sh`](https://github.com/bazelbuild/bazel/blob/master/src/upload_all_java_tools.sh), which does the following: 1. Builds `java_tools` zips for each supported java version (9, 10, 11, 12). 2. Runs the java integration tests using the `java_toolchain` in each generated `java_tools`. 3. If all tests are successful uploads each `java_tools` zip to GCP (via [src/upload_java_tools.sh](https://github.com/bazelbuild/bazel/blob/master/src/upload_java_tools.sh)). The zips are uploaded under [bazel-mirror/bazel_java_tools/tmp/build](https://console.cloud.google.com/storage/browser/bazel-mirror/bazel_java_tools/tmp/build) to a file defined by: the commit hash where the tools were built, the javac version, the platform and the timestamp when they were uploaded: ``` bazel-mirror/bazel_java_tools/tmp/build/${commit_hash}/java${java_version}/java_tools_javac${java_version}_${platform}-${timestamp}.zip ``` ## Releasing Both creating a release candidate and creating a release use the same script [`src/create_java_tools_release.sh`](https://github.com/bazelbuild/bazel/blob/master/src/create_java_tools_release.sh). In both cases the script needs to know: - the javac version archived in the wanted RC/release - the version number of the java_tools to be released - the release candidate number (either to be created or to be released) - the commit hash where the zip was built - a boolean telling whether it’s creating a release candidate or a release ### Creating a release candidate To create a release candidate invoke the [`src/create_java_tools_release.sh`](https://github.com/bazelbuild/bazel/blob/master/src/create_java_tools_release.sh) script with the parameters set accordingly to the way described above in the *Releasing* section. When creating release candidates the script assumes that the `java_tools` pipeline was already run at the same commit hash passed to the script. The script identifies where the `java_tools` zip was uploaded on GCP by the `java_tools` pipeline and copy it under a [GCP `release_candidates` directory](https://console.cloud.google.com/storage/browser/bazel-mirror/bazel_java_tools/release_candidates/): ``` release_candidates/javac${java_version}/v${java_tools_version}/java_tools_javac${java_version}_${platform}-v${java_tools_version}-rc${rc}.zip ``` The uploaded file is the new release candidate. Bazel can be tested by updating the `java_tools` urls and checksums to the new RC url and its checksum. ### Creating a release To create a release invoke the [`src/create_java_tools_release.sh`](https://github.com/bazelbuild/bazel/blob/master/src/create_java_tools_release.sh) script with the parameters set accordingly to the way described above in the *Releasing* section. When creating releases the script assumes that a release candidate with the given number was previously created by the script. The script identifies where the release candidate with the given number was uploaded on GCP and copy it under a [GCP `releases` directory](https://console.cloud.google.com/storage/browser/bazel-mirror/bazel_java_tools/releases/): ``` releases/javac${java_version}/v${java_tools_version}/java_tools_javac${java_version}_${platform}-v${java_tools_version}-rc${rc}.zip ``` The uploaded file is the new release. Bazel can be updated to use new release by updating the `java_tools` urls and checksums to the new release. java_tools-java_13.6.1/docs/release-automated.md000066400000000000000000000216121462114331700216230ustar00rootroot00000000000000**This playbook describes the updated java_tools release process. If you see any errors or issues with automation, please follow the manual release process documented [here](https://github.com/bazelbuild/java_tools/blob/master/docs/release.md).** # Release Process 1. Create a new tracking issue for the release in this repository using the ["release tracker" template](https://github.com/bazelbuild/java_tools/issues/new/choose). 2. Trigger a new build of the [java_tools binaries pipeline](https://buildkite.com/bazel-trusted/java-tools-binaries-java). Set the message field to "java_tools release [version] [rc]", and leave the commit field as "HEAD" and branch as "master". See [example](https://buildkite.com/bazel-trusted/java-tools-binaries-java/builds/233). 3. Get the commit hash where the pipeline was run (e.g. `c7d8d1e3f16ac6db37b134358b6cfdb5e3c8f6b0` for v13.1) 4. Create a new release candidate by triggering a new build of the [java-tools-rc pipeline](https://buildkite.com/bazel-trusted/java-tools-rc). Set the message field to "java_tools release [version] [rc]", and leave the commit field as "HEAD" and branch as "master". Click on "release information" and enter the required details. See [example](https://buildkite.com/bazel-trusted/java-tools-rc/builds/1). ``` Version: 13.1 RC: 1 Commit hash: c7d8d1e3f16ac6db37b134358b6cfdb5e3c8f6b0 Final release: false ``` 5. Create a new branch in the [rules_java](https://github.com/bazelbuild/rules_java) repository and name it `java_v[version number]`, e.g. `java_v13.1`. Edit [java/repositories.bzl](https://github.com/bazelbuild/rules_java/blob/master/java/repositories.bzl) by copying the output from step 4 to `_JAVA_TOOLS_CONFIG`. Refer to [this example](https://github.com/bazelbuild/rules_java/commit/8b3d6fd2728610c71be2f6937783a396de139576). ```starlark _JAVA_TOOLS_CONFIG = { "version": "v13.1", "release": "false", "artifacts": { "java_tools_linux": { "mirror_url": "https://mirror.bazel.build/bazel_java_tools/release_candidates/java/v13.1/java_tools_linux-v13.1-rc1.zip", "sha": "d134da9b04c9023fb6e56a5d4bffccee73f7bc9572ddc4e747778dacccd7a5a7" }, "java_tools_windows": { "mirror_url": "https://mirror.bazel.build/bazel_java_tools/release_candidates/java/v13.1/java_tools_windows-v13.1-rc1.zip", "sha": "c5c70c214a350f12cbf52da8270fa43ba629b795f3dd328028a38f8f0d39c2a1" }, "java_tools_darwin_x86_64": { "mirror_url": "https://mirror.bazel.build/bazel_java_tools/release_candidates/java/v13.1/java_tools_darwin_x86_64-v13.1-rc1.zip", "sha": "0db40d8505a2b65ef0ed46e4256757807db8162f7acff16225be57c1d5726dbc" }, "java_tools_darwin_arm64": { "mirror_url": "https://mirror.bazel.build/bazel_java_tools/release_candidates/java/v13.1/java_tools_darwin_arm64-v13.1-rc1.zip", "sha": "dab5bb87ec43e980faea6e1cec14bafb217b8e2f5346f53aa784fd715929a930" }, "java_tools": { "mirror_url": "https://mirror.bazel.build/bazel_java_tools/release_candidates/java/v13.1/java_tools-v13.1-rc1.zip", "sha": "286bdbbd66e616fc4ed3f90101418729a73baa7e8c23a98ffbef558f74c0ad14" } } } ``` 6. Update [workspace_deps.bzl](https://github.com/bazelbuild/bazel/blob/master/workspace_deps.bzl) in the Bazel repository and create a new draft pull request to trigger the CI presubmit. Refer to [this PR](https://github.com/bazelbuild/bazel/pull/20045) (specifically [this commit](https://github.com/bazelbuild/bazel/pull/20045/commits/b0ec360581ee665faf2298641ef4bb6feee12f9d)) * Get the commit hash for the changes made in step 5 (e.g. `8b3d6fd2728610c71be2f6937783a396de139576` for [this commit](https://github.com/bazelbuild/rules_java/commit/8b3d6fd2728610c71be2f6937783a396de139576)) * Download the tar.gz file at `https://github.com/bazelbuild/rules_java/archive/.tar.gz` * Run `shasum -a 256 ` * Update the following fields: `archive`, `sha256`, `urls`, `strip_prefix` (to be added) Example: ```starlark "archive": "8b3d6fd2728610c71be2f6937783a396de139576.tar.gz", "sha256": "e8a6427d7882215b009c048f996499e89c9e43c13c56234da16a49b154c46546", "strip_prefix": "rules_java-8b3d6fd2728610c71be2f6937783a396de139576", "urls": ["https://github.com/bazelbuild/rules_java/archive/8b3d6fd2728610c71be2f6937783a396de139576.tar.gz"],` ``` 7. Add archive_override to [MODULE.bazel](https://github.com/bazelbuild/bazel/blob/master/MODULE.bazel) * To calculate the `integrity` value of the source archive, trigger the [BCR integrity pipeline](https://buildkite.com/bazel-trusted/bcr-integrity). Set the message field to "java_tools release [version] [rc]", and leave the commit field as "HEAD" and branch as "main". Click on "get archive" and enter the `.tar.gz` (e.g. `8b3d6fd2728610c71be2f6937783a396de139576.tar.gz`). The integrity value will be printed at the end of the "calculate integrity value" step. See [example](https://buildkite.com/bazel-trusted/bcr-integrity/builds/13). * Alternately, run `cat .tar.gz | openssl dgst -sha256 -binary | base64`. * Add archive_override with the `integrity` and commit hash from above. Example: ```starlark archive_override( module_name = "rules_java", urls = ["https://github.com/bazelbuild/rules_java/archive/8b3d6fd2728610c71be2f6937783a396de139576.tar.gz"], integrity = "sha256-6KZCfXiCIVsAnASPmWSZ6JyeQ8E8ViNNoWpJsVTEZUY=", strip_prefix = "rules_java-8b3d6fd2728610c71be2f6937783a396de139576", ) ``` 8. Trigger a new build on Downstream https://buildkite.com/bazel/bazel-at-head-plus-downstream. Set the message field to "java_tools release [version] [rc]", leave the commit field as "HEAD", and use `pull/[PRNUMBER]/head` for the branch. See [example](https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/2818). Check the results of the build to confirm that there are no new failures (i.e. all failures also appear at HEAD). To do this, compare the results to the latest run [here](https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds?branch=master). If the CI finishes unsuccessfully, find the reasons why the CI is failing and file bugs. After the bugs are fixed, start all over again from step 2 and create the next release candidate. This case is highly unlikely because Bazel already tests the `java_tools` built at head. If the CI finishes successfully: 9. Create the release artifacts from the release candidate by triggering a new build of the [java-tools-rc pipeline](https://buildkite.com/bazel-trusted/java-tools-rc). Set the message field to "java_tools release [version] [rc]", and leave the commit field as "HEAD" and branch as "master". Click on "release information" and enter the required details. ``` Version: 13.1 RC: 1 Commit hash: c7d8d1e3f16ac6db37b134358b6cfdb5e3c8f6b0 Final release: true ``` 10. Create a [java_tools release](https://github.com/bazelbuild/java_tools/releases) on GitHub by triggering the [java-tools-release pipeline](https://buildkite.com/bazel-trusted/java-tools-release). Set the message field to "java_tools release [version] [rc]", and leave the commit field as "HEAD" and branch as "master". Click on "artifacts information" and paste the output from the step above. See [example](https://buildkite.com/bazel-trusted/java-tools-release/builds/2). 11. Return to the rules_java repository and create a PR to update [java/repositories.bzl](https://github.com/bazelbuild/rules_java/blob/master/java/repositories.bzl) with the latest java_tools versions. After making sure presubmits pass, send the PR for review and assign `@hvadehra`. Refer to [this example](https://github.com/bazelbuild/rules_java/pull/119) (it also includes the 2 updates needed for the next step). 12. Follow the steps [here](https://github.com/bazelbuild/rules_java/tree/master/distro) to release a new version of rules_java. 13. Update Bazel with the final rules_java version by editing the following files. After making sure presubmits pass, send the PR for review and assign `@hvadehra`. Refer to [this PR](https://github.com/bazelbuild/bazel/pull/18902). - https://github.com/bazelbuild/bazel/blob/master/workspace_deps.bzl ([example](https://github.com/bazelbuild/bazel/commit/ef5648ef4e0a48291c8bd5ff02a96ef03d69cf04)) - https://github.com/bazelbuild/bazel/blob/master/src/MODULE.tools ([example](https://github.com/bazelbuild/bazel/pull/18902/commits/73c8858d5195f072bbb316a3bf1289de1646d91a)) - https://github.com/bazelbuild/bazel/blob/master/MODULE.bazel ([example](https://github.com/bazelbuild/bazel/pull/18902/commits/5b30bc4f23037f5651063e24c1881328720d6bcb)). Remove the archive_override() method as well. java_tools-java_13.6.1/docs/release.md000066400000000000000000000325041462114331700176440ustar00rootroot00000000000000# Release Process *Note: This document describes how to release java_tools for a JDK version that is already tested by Bazel. This document is addressed to trusted members of the Bazel team who have access to the Buildkite Bazel trusted pipelines and GCP. If you want to release the Java tools but don’t have these permissions please contact someone from the Bazel EngProd team (bazel-engprod@google.com).* The steps below are only meant to be followed as presented in order to release a new java_tools version. To understand the mechanism behind these steps and for more details about how the process works, see [Behind the java_tools release process](behind-the-release.md). 1. Create a new tracking issue for the release in this repository and add the `release` label. See [#59](https://github.com/bazelbuild/java_tools/issues/59) as an example. 2. Trigger a new build of the [`java_tools binaries pipeline`](https://buildkite.com/bazel-trusted/java-tools-binaries-java). Set the message field to "java_tools release [version] [rc]", and leave the commit field as "HEAD" and branch as "master". See [example](https://buildkite.com/bazel-trusted/java-tools-binaries-java/builds/189). 3. Identify and set the following environment variables: * `COMMIT_HASH` the commit hash where the pipeline was run (see below) * `NEW_VERSION` the new version number you’re trying to release (e.g. `11.09`) * `RC` the number of the current release candidate For example: ```bash export COMMIT_HASH=7bd0ab63a8441c3f3d7f495d09ed2bed38762874 export NEW_VERSION=11.09 export RC=1 ``` 4. Create a new release candidate by running the command below from the [bazel](https://github.com/bazelbuild/bazel) repo: ```bash src/create_java_tools_release.sh \ --commit_hash $COMMIT_HASH \ --java_tools_version $NEW_VERSION \ --rc $RC --release false ``` The script will output the sha256sum of the rc artifacts for linux, darwin and windows. Sample output: ```bash $ src/create_java_tools_release.sh --commit_hash 7bd0ab63a8441c3f3d7f495d09ed2bed38762874 --java_tools_version 11.9 --rc 1 --release false release_candidates/java/v11.9/java_tools_linux-v11.9-rc1.zip 512582cac5b7ea7974a77b0da4581b21f546c9478f206eedf54687eeac035989 release_candidates/java/v11.9/java_tools_windows-v11.9-rc1.zip 677ab910046205020fd715489147c2bcfad8a35d9f5d94fdc998d217545bd87a release_candidates/java/v11.9/java_tools_darwin_x86_64-v11.9-rc1.zip b9e962c6a836ba1d7573f2473fab3a897c6370d4c2724bde4017b40932ff4fe4 release_candidates/java/v11.9/java_tools_darwin_arm64-v11.9-rc1.zip 3a897c6370d4c2724bde4017b40932ff4fe4b9e962c6a836ba1d7573f2473fab release_candidates/java/v11.9/java_tools-v11.9-rc1.zip 5cd59ea6bf938a1efc1e11ea562d37b39c82f76781211b7cd941a2346ea8484d ``` 5. Create a new branch in the [rules_java](https://github.com/bazelbuild/rules_java) repository * Name the branch `java_v[version number]`, e.g. `java_v11.09` * Edit [java_tools_repos()](https://github.com/bazelbuild/rules_java/blob/master/java/repositories.bzl#L22-L73) by updating the `sha256` and `urls` fields for `remote_java_tools` with the correct version, rc, sha256sum, and url (see output from step 4) Example: ```starlark maybe( http_archive, name = "remote_java_tools", sha256 = "5cd59ea6bf938a1efc1e11ea562d37b39c82f76781211b7cd941a2346ea8484d", urls = [ "https://mirror.bazel.build/bazel_java_tools/release_candidates/java/v11.9/java_tools-v11.9-rc1.zip", ], ) ``` * Repeat for `remote_java_tools_linux`, `remote_java_tools_windows`, `remote_java_tools_darwin_x86_64` and `remote_java_tools_darwin_arm64` * Refer to [this example](https://github.com/bazelbuild/rules_java/commit/d1196d250c17dfffed52db13c75d4f9b9cd20617) 6. Edit [workspace_deps.bzl](https://github.com/bazelbuild/bazel/blob/master/workspace_deps.bzl) in the Bazel repository and create a new pull request. This PR will trigger the CI presubmit. * Get the commit hash for the changes made in step 5 (e.g. `d1196d250c17dfffed52db13c75d4f9b9cd20617` for [this commit](https://github.com/bazelbuild/rules_java/commit/d1196d250c17dfffed52db13c75d4f9b9cd20617)) * Download the tar.gz file at `https://github.com/bazelbuild/rules_java/archive/.tar.gz` * Run `shasum -a 256 ` * Update the following fields (note: add `strip_prefix`) Example: ```starlark "archive": "d1196d250c17dfffed52db13c75d4f9b9cd20617.tar.gz", "sha256": "0f65c471b99c79e97dd18a3571d3707b4dbfc31ff8e9bf7083a09aae0adb7b5e", "strip_prefix": "rules_java-d1196d250c17dfffed52db13c75d4f9b9cd20617", "urls": ["https://github.com/bazelbuild/rules_java/archive/d1196d250c17dfffed52db13c75d4f9b9cd20617.tar.gz"], ``` * Refer to [this PR](https://github.com/bazelbuild/bazel/pull/18902) (specifically [this commit](https://github.com/bazelbuild/bazel/pull/18902/commits/26ea92bfa57c2706c10c82714ff9a3094c6a39ad)) * Add archive_override to MODULE.bazel * To calculate the `integrity` value of the source archive, do: ```bash $ git clone https://github.com/bazelbuild/bazel-central-registry.git $ cd bazel-central-registry $ python3 ./tools/calc_integrity.py https://github.com/bazelbuild/rules_java/archive/d1196d250c17dfffed52db13c75d4f9b9cd20617.tar.gz ``` * Add archive_override with the `integrity` and commit hash from above Example: ```starlark archive_override( module_name = "rules_java", urls = ["https://github.com/bazelbuild/rules_java/archive/d1196d250c17dfffed52db13c75d4f9b9cd20617.tar.gz"], integrity = "sha256-4YvfBdBJhBvZNJh8nz0RRpdMI+CFuM4O8xRb3d1GinA=", strip_prefix = "rules_java-d1196d250c17dfffed52db13c75d4f9b9cd20617", ) ``` * Refer to [this PR](https://github.com/bazelbuild/bazel/pull/18902) (specifically [this commit](https://github.com/bazelbuild/bazel/pull/18902/commits/642c32aa6e07d76654ac4210e7119e84e7bf2f82)) 7. Trigger a new build on Downstream https://buildkite.com/bazel/bazel-at-head-plus-downstream. Set the message field to "java_tools release [version] [rc]", leave the commit field as "HEAD", and use `pull/[PRNUMBER]/head` for the branch. See [example](https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/2818). 1. Check the results of the build to confirm that there are no new failures (i.e. all failures also appear at HEAD). To do this, compare the results to the latest run [here](https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds?branch=master). 2. If the CI finishes successfully: - Create the release artifacts from the release candidate: ```bash src/create_java_tools_release.sh \ --java_tools_version $NEW_VERSION \ --rc $RC --release true ``` The script will output the sha256sum of the rc artifacts for linux, darwin and windows. Sample output: ```bash $ src/create_java_tools_release.sh --commit_hash 7bd0ab63a8441c3f3d7f495d09ed2bed38762874 --java_tools_version 11.9 --rc 1 --release true releases/java/v11.9/java_tools_linux-v11.9.zip 512582cac5b7ea7974a77b0da4581b21f546c9478f206eedf54687eeac035989 releases/java/v11.9/java_tools_windows-v11.9.zip 677ab910046205020fd715489147c2bcfad8a35d9f5d94fdc998d217545bd87a releases/java/v11.9/java_tools_darwin_x86_64-v11.9.zip b9e962c6a836ba1d7573f2473fab3a897c6370d4c2724bde4017b40932ff4fe4 releases/java/v11.9/java_tools_darwin_arm64-v11.9.zip 3a897c6370d4c2724bde4017b40932ff4fe4b9e962c6a836ba1d7573f2473fab releases/java/v11.9/java_tools-v11.9.zip 5cd59ea6bf938a1efc1e11ea562d37b39c82f76781211b7cd941a2346ea8484d ``` - Update the release in the java_tools [releases page](https://github.com/bazelbuild/java_tools/releases) - Click on "Draft a new release" - Set tag to java_v[version number], e.g. java_v11.09 - Set target to master - Add the name, sha256, and urls to the description Example: ``` To use this java_tools release, add to your WORKSPACE file the definitions: http_archive( name = "remote_java_tools", sha256 = "5cd59ea6bf938a1efc1e11ea562d37b39c82f76781211b7cd941a2346ea8484d", urls = [ "https://mirror.bazel.build/bazel_java_tools/releases/java/v11.9/java_tools-v11.9.zip", "https://github.com/bazelbuild/java_tools/releases/download/java_v11.9/java_tools-v11.9.zip", ], ) http_archive( name = "remote_java_tools_linux", sha256 = "512582cac5b7ea7974a77b0da4581b21f546c9478f206eedf54687eeac035989", urls = [ "https://mirror.bazel.build/bazel_java_tools/releases/java/v11.9/java_tools_linux-v11.9.zip", "https://github.com/bazelbuild/java_tools/releases/download/java_v11.9/java_tools_linux-v11.9.zip", ], ) http_archive( name = "remote_java_tools_windows", sha256 = "677ab910046205020fd715489147c2bcfad8a35d9f5d94fdc998d217545bd87a", urls = [ "https://mirror.bazel.build/bazel_java_tools/releases/java/v11.9/java_tools_windows-v11.9.zip", "https://github.com/bazelbuild/java_tools/releases/download/java_v11.9/java_tools_windows-v11.9.zip", ], ) http_archive( name = "remote_java_tools_darwin_x86_64", sha256 = "b9e962c6a836ba1d7573f2473fab3a897c6370d4c2724bde4017b40932ff4fe4", urls = [ "https://mirror.bazel.build/bazel_java_tools/releases/java/v11.9/java_tools_darwin_x86_64-v11.9.zip", "https://github.com/bazelbuild/java_tools/releases/download/java_v11.9/java_tools_darwin_x86_64-v11.9.zip", ], ) http_archive( name = "remote_java_tools_darwin_arm64", sha256 = "3a897c6370d4c2724bde4017b40932ff4fe4b9e962c6a836ba1d7573f2473fab", urls = [ "https://mirror.bazel.build/bazel_java_tools/releases/java/v11.9/java_tools_darwin_arm64-v11.9.zip", "https://github.com/bazelbuild/java_tools/releases/download/java_v11.9/java_tools_darwin_arm64-v11.9.zip", ], ) ``` - Download the 5 .zip files from the updated https://mirror.bazel.build URLs above and attach them to the release - Set as the latest release - Refer to [this example](https://github.com/bazelbuild/java_tools/releases/tag/java_v11.9) - Return to the rules_java repository and create a PR to update [java_tools_repos()](https://github.com/bazelbuild/rules_java/blob/master/java/repositories.bzl#L22-L73) with the latest java_tools versions. After making sure presubmits pass, send the PR for review and assign `@hvadehra`. Refer to [this example](https://github.com/bazelbuild/rules_java/pull/119) (it also includes the 2 updates needed for the next step). - Follow the steps [here](https://github.com/bazelbuild/rules_java/tree/master/distro) to release a new version of rules_java. Reach out to `@hvadhera` to decide/confirm the version number bump. - In order for checks to pass in the next step, the release must be mirrored to the Bazel Central Registry. Make sure that a PR is opened and approved in the BCR repository ([example](https://github.com/bazelbuild/bazel-central-registry/pull/774)) - One time step: Add the `publish-to-bcr` app to your personal fork of `bazelbuild/bazel-central-registry`. Refer to the instructions [here](https://github.com/bazel-contrib/publish-to-bcr/blob/main/README.md). - Update Bazel with the final rules_java version by editing the following files. After making sure presubmits pass, send the PR for review and assign `@hvadehra`. Refer to [this PR](https://github.com/bazelbuild/bazel/pull/18902). - https://github.com/bazelbuild/bazel/blob/master/workspace_deps.bzl ([example](https://github.com/bazelbuild/bazel/commit/ef5648ef4e0a48291c8bd5ff02a96ef03d69cf04)) - https://github.com/bazelbuild/bazel/blob/master/src/MODULE.tools ([example](https://github.com/bazelbuild/bazel/pull/18902/commits/73c8858d5195f072bbb316a3bf1289de1646d91a)) - https://github.com/bazelbuild/bazel/blob/master/MODULE.bazel# ([example](https://github.com/bazelbuild/bazel/pull/18902/commits/5b30bc4f23037f5651063e24c1881328720d6bcb)). Remove the archive_override() method as well. 3. If the CI finishes unsuccessfully find the reasons why the CI is failing and file bugs. After the bugs are fixed start all over again from step 2 and create the next release candidate. This case is highly unlikely because Bazel already tests the `java_tools` built at head. java_tools-java_13.6.1/scripts/000077500000000000000000000000001462114331700164355ustar00rootroot00000000000000java_tools-java_13.6.1/scripts/release.py000066400000000000000000000034031462114331700204270ustar00rootroot00000000000000# Copyright 2022 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Script to get release notes + zip files to release java_tools.""" import argparse import wget import json def generate_release_info(platform, artifacts): return ''' http_archive( name = "remote_{platform}", sha256 = "{sha}", urls = [ "{mirror_url}", "{github_url}" ] )'''.format( platform = platform, sha = artifacts["sha"], mirror_url = artifacts["mirror_url"], github_url = artifacts["github_url"] ) def download_file(mirror_url): wget.download(mirror_url , '.') def main(): parser = argparse.ArgumentParser() parser.add_argument( '--artifacts', required=True, dest='artifacts', help='Output from create_java_tools_release.sh') opts = parser.parse_args() artifacts = json.loads(opts.artifacts)["artifacts"] relnotes = "To use this java_tools release, add to your WORKSPACE file the definitions: \n```py" for platform in artifacts: relnotes += generate_release_info(platform, artifacts[platform]) download_file(artifacts[platform]["mirror_url"]) relnotes += "\n```" with open('relnotes.txt', 'w') as f: f.write(relnotes) if __name__ == '__main__': main()