-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move tools required for Java builds (JavaBuilder, ijar, singlejar etc.) to remote repository #6316
Comments
For Java-based tools that are distributed as jars (JavaBuilder, turbine, javac) the remote repo can just contain deploy jars, right? But for ijar and singlejar it will need sources since those tools are currently build from source during the build? Will this involve moving the sources for these tools out of the main Bazel repo and into a separate repository, or is it sufficient to leave the sources where they are and publish release artifacts somewhere so they can be used as a remote repo? |
We still have to publish the srcs along with the release artifacts for licensing reasons if I'm not mistaken. |
Right, but an archive of the sources could be published to mirror.bazel.build, that doesn't necessarily require that the development happen in a separate repository. I don't think it'll make too much of difference to copybara, I was just curious what the plan is. |
For remote execution having either sources (preferable) or platform agnostic binaries will be necessary. Specifically for tools like SingleJar and ijar the sources must be available for projects to compile them for the execution platform as part of a remote build. |
instead of embedding the deploy jars built at the same time with the bazel binary. This comes in preparation for moving the Java tools to remote repositories (see #6316). Moving the tools happens in two phases: 1. Using checked-in deploy jars/binaries instead of those built when bazel was built 2. Moving the checked-in jars/binaries to a remote repository and make bazel reference them from there. This step can only happen under an incompatible flag. This PR addresses the first point. Doing the move incrementally this way is safer and allows finding bugs earlier. It also allows moving the Java tools code base out of the bazel repository. We are making this change gradually for each java tool defined in JAVA_TOOLS (found in src/BUILD). Closes #7114. PiperOrigin-RevId: 229524951
instead of embedding the deploy jar that is built when the bazel binary is built. This comes in preparation for moving the Java tools to remote repositories (see bazelbuild#6316). This checked in jar will be moved to a remote repository and referenced from there. Moving the Java tools happens in two phases: Using checked-in deploy jars/binaries instead of those built when bazel was built Moving the checked-in jars/binaries to a remote repository and make bazel reference them from there. This PR addresses the first point for JarJar. Doing the move incrementally this way is safer and allows finding bugs earlier. It also allows moving the Java tools code base out of the bazel repository. We are making this change gradually for each java tool defined in JAVA_TOOLS (found in src/BUILD).
This comes in preparation for moving the Java tools to remote repositories (see bazelbuild#6316). This checked in jar will be moved to a remote repository and referenced from there. Moving the Java tools happens in two phases: Using checked-in deploy jars/binaries instead of those built when bazel was built Moving the checked-in jars/binaries to a remote repository and make bazel reference them from there. This PR addresses the first point for JarJar. Doing the move incrementally this way is safer and allows finding bugs earlier. It also allows moving the Java tools code base out of the bazel repository. We are making this change gradually for each java tool defined in JAVA_TOOLS (found in src/BUILD).
This comes in preparation for moving the Java tools to remote repositories (see #6316). This checked in jar will be moved to a remote repository and referenced from there. Moving the Java tools happens in two phases: Using checked-in deploy jars/binaries instead of those built when bazel was built Moving the checked-in jars/binaries to a remote repository and make bazel reference them from there. This PR addresses the first point for JarJar. Doing the move incrementally this way is safer and allows finding bugs earlier. It also allows moving the Java tools code base out of the bazel repository. We are making this change gradually for each java tool defined in JAVA_TOOLS (found in src/BUILD). Partial commit for third_party/*, see #7145. Signed-off-by: iirina <elenairina@google.com>
instead of embedding the deploy jar that is built when the bazel binary is built. This comes in preparation for moving the Java tools to remote repositories (see #6316). This checked in jar will be moved to a remote repository and referenced from there. Moving the Java tools happens in two phases: Using checked-in deploy jars/binaries instead of those built when bazel was built Moving the checked-in jars/binaries to a remote repository and make bazel reference them from there. This PR addresses the first point for `JarJar`. Doing the move incrementally this way is safer and allows finding bugs earlier. It also allows moving the Java tools code base out of the bazel repository. We are making this change gradually for each java tool defined in JAVA_TOOLS (found in src/BUILD). Closes #7143. PiperOrigin-RevId: 229548071
instead of embedding the deploy jars built at the same time with the bazel binary. This comes in preparation for moving the Java tools to remote repositories (see bazelbuild#6316). Moving the tools happens in two phases: 1. Using checked-in deploy jars/binaries instead of those built when bazel was built 2. Moving the checked-in jars/binaries to a remote repository and make bazel reference them from there. This step can only happen under an incompatible flag. This PR addresses the first point. Doing the move incrementally this way is safer and allows finding bugs earlier. It also allows moving the Java tools code base out of the bazel repository. We are making this change gradually for each java tool defined in JAVA_TOOLS (found in src/BUILD). Closes bazelbuild#7114. PiperOrigin-RevId: 229524951
This comes in preparation for moving the Java tools to remote repositories (see bazelbuild#6316). This checked in jar will be moved to a remote repository and referenced from there. Moving the Java tools happens in two phases: Using checked-in deploy jars/binaries instead of those built when bazel was built Moving the checked-in jars/binaries to a remote repository and make bazel reference them from there. This PR addresses the first point for JarJar. Doing the move incrementally this way is safer and allows finding bugs earlier. It also allows moving the Java tools code base out of the bazel repository. We are making this change gradually for each java tool defined in JAVA_TOOLS (found in src/BUILD). Partial commit for third_party/*, see bazelbuild#7145. Signed-off-by: iirina <elenairina@google.com>
instead of embedding the deploy jar that is built when the bazel binary is built. This comes in preparation for moving the Java tools to remote repositories (see bazelbuild#6316). This checked in jar will be moved to a remote repository and referenced from there. Moving the Java tools happens in two phases: Using checked-in deploy jars/binaries instead of those built when bazel was built Moving the checked-in jars/binaries to a remote repository and make bazel reference them from there. This PR addresses the first point for `JarJar`. Doing the move incrementally this way is safer and allows finding bugs earlier. It also allows moving the Java tools code base out of the bazel repository. We are making this change gradually for each java tool defined in JAVA_TOOLS (found in src/BUILD). Closes bazelbuild#7143. PiperOrigin-RevId: 229548071
…t java_toolchain and host_java_toolchain. This PR introduces the flags: * `--incompatible_use_remote_host_java_toolchain` * `--incompatible_use_remote_java_toolchain` Progress on bazelbuild#6316 bazelbuild#7196 bazelbuild#7197 Closes bazelbuild#7156. PiperOrigin-RevId: 230209934
Transitively this pulls in skydoc which pulls in other large deps, so this is one step closer to a smaller bazel binary, see #6316. RELNOTES: None PiperOrigin-RevId: 232215895
Please do not assign issues to more than one team |
The flags that enable using remote Java tools by default were pushed in 4d935d5. This PR shrinks the bazel binary by ~25%. To measure the binary sizes I used `bazel build -c opt //src:bazel` at a57c879 with and without the changes in this PR: ``` $ ls -lh ~/bazel-with-java-tools | awk '{print $5}' 141M $ ls -lh ~/bazel-no-java-tools | awk '{print $5}' 105M ``` Progress on #6316. Closes #7472. PiperOrigin-RevId: 234972713
Update: all tools except singlejar and ijar (sources) have been removed, reducing the bazel binary size by 33%. |
Bazel now doesn't embed ijar anymore and uses ijar embeded in the Java tools remote repository. Bazel embedded both ijar's source code (required by remote execution) and platform specific pre-built binaries. This change adds platform specific remote Java tools repository that include the corresponding pre-built ijar binary (for Windows, Darwin and Linux), alongside ijar's source code. This change introduces a collection of macros that wrap the native rules `filegroup` and `java_import` and select a given target from the external java tools repository based on the current platform. Progress on #6316. Closes #7665. PiperOrigin-RevId: 238613298
Just discovered this change after trying to rev our builds to 0.24.0. This is causing some trouble for CI instances w/o access to the public internet, because they now need to reach out to mirror.bazel.build to locate turbine, singlejar, et al. Additionally, I peeked into the java_tools_pkg archive, and it contains naked jars but w/o any indication of their provenance, how to rebuild them from source, etc etc. What is the Bazel team's recommendation? Ideally I would prefer to continue embedding these binaries with our Bazel distribution, but if a remote repo is the only option, I at least need to be able to build all the tools myself and host them internally. (I.e. maybe I have to maintain my own internal java_tools_pkg build process, and then I patch my internal copy's URL into src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.) |
We are still working on a good way to pass your own built archive. We currently host archives with their sources on mirror.bazel.build but only for licensing purposes and without the BUILD files to be able to rebuild the tools from source. Until we have a better solution you can do the following:
|
Gotcha. Thanks for the follow-up! I backported some of your changes to 0.24.0 so that I can build the Java tools locally. So, that much is good. However, As for long-term maintenance, could the Java tools team please look into publishing build instructions, release information, etc. with each |
Yes, definitely. We'll get onto this ASAP. The cleaner path forward is to publish releases with the source files + the associated BUILD files, so that anyone can just build the tools from a published source release. |
Part of https://docs.google.com/document/d/1Igmv-2GfXkoVFWTXvBYPeniQom8nLAwzqzridDlBIS4/edit?ts=5babff11#heading=h.wg6xrnp53jla and the logical next step after #6313.
That's also a good step in the direction to have different JavaBuilder versions for different versions of the JDK.
The text was updated successfully, but these errors were encountered: