-
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
Only use JAVA_HOME/@local_jdk as the default --javabase #5594
Comments
To confirm, is the request to support using the embedded JDK as the If the goal is to have |
Not quite. What I'm really looking for is a way to completely eliminate uses of any JDKs found via I would also like a way to use the embedded JDK as the alternative so I have less stuff to version, but I wouldn't mind versioning a separate one via a bazel package too much. As far as I can see, there are no user-accessible flags to change |
To try to recap, there are three JDKs:
(1) and (2) now default to the embedded JDK (which is not the local JDK). They should be unaffected by (3) is the one that depends on If you obtain a separate JDK 8, create a Does that match what you're seeing?
This makes sense, but it isn't really the intended use-case for the embedded JDK. There's some discussion about shipping a minimal JDK that contains only what's need for the host_javabase use-case, which probably isn't what's wanted fro a target |
There's some discussion happening about making it possible to configure host JDKs using remote repositories or similar, and it would probably be possible to use the same approach for target JDKs. So if you want the ability to version the host and target JDKs and avoid implicitly depending on the local JDK that'd be another way to approach it. This original feature request (of using the embedded JDK as a target JDK) is not something we're likely to pursue for the reason I mentioned above: we want to make the embedded JDK image as a small as possible to reduce the installation size. |
@cushon
Are there tickets for these discussions (depending on an external versioned
jdk for host/target)?
…On Thu, 26 Jul 2018 at 17:30 Liam Miller-Cushon ***@***.***> wrote:
@philwo <https://github.com/philwo> @buchgr <https://github.com/buchgr>
FYI
There's some discussion happening about making it possible to configure
host JDKs using remote repositories or similar, and it would probably be
possible to use the same approach for target JDKs. So if you want the
ability to version the host and target JDKs and avoid implicitly depending
on the local JDK that'd be another way to approach it.
This original feature request (of using the embedded JDK as a target JDK)
is not something we're likely to pursue for the reason I mentioned above:
we want to make the embedded JDK image as a small as possible to reduce the
installation size.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#5594 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABUIFxQaUNJTbTzOh8lWcW80q_ySjISJks5uKeCsgaJpZM4VPYjF>
.
|
Even if I set --javabase and --host_javabase, builds still don't work on a machine where |
Specifically, with this WORKSPACE: new_http_archive(
name = "zulu_jdk8",
build_file = "zulu_jdk8.BUILD",
sha256 = "65a1b180ad46c5a1cc2f9ffff29b85d682c0e937b7b964b557f2a3b9084de5b9",
strip_prefix = "zulu8.30.0.1-jdk8.0.172-linux_x64",
url = "https://cdn.azul.com/zulu/bin/zulu8.30.0.1-jdk8.0.172-linux_x64.tar.gz",
) And this BUILD: genrule(
name = "gen_main",
outs = ["Main.java"],
cmd = "echo \"class Main { public static void main(String[] args) {} }\" > $@",
)
java_binary(
name = "main",
srcs = ["Main.java"],
main_class = "Main",
) This works (I'm doing this on a machine with a working JDK found via $ /tmp/bazel-0.15.2-linux-x86_64 build //...
INFO: Build options have changed, discarding analysis cache.
INFO: Analysed 2 targets (16 packages loaded).
INFO: Found 2 targets...
INFO: Elapsed time: 5.201s, Critical Path: 2.85s
INFO: 2 processes: 1 linux-sandbox, 1 worker.
INFO: Build completed successfully, 7 total actions But this fails: $ JAVA_HOME=/nonexistent /tmp/bazel-0.15.2-linux-x86_64 build //...
WARNING: Running Bazel server needs to be killed, because the startup options are different.
Starting local Bazel server and connecting to it...
.....................
ERROR: /x1/home/brian/.cache/bazel/_bazel_brian/9a14994a41429a580e5cd8b6f1b379ce/external/bazel_tools/tools/jdk/BUILD:181:1: no such package '@local_jdk//': Expected directory at /nonexistent but it does not exist. and referenced by '@bazel_tools//tools/jdk:jdk'
ERROR: Analysis of target '//:main' failed; build aborted: Analysis failed
INFO: Elapsed time: 6.264s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (10 packages loaded)
currently loading: @bazel_tools//src/tools/launcher ... (2 packages) |
Are you setting the |
I was using the build flag because I didn't realize there was a startup one. What version of JDK is supported for the startup one? If I use a Java 8 one, it breaks because |
The default JDK 9 isn't supported as a target If you use |
Oh, I was testing the wrong bazel binary... ERROR: /x1/home/brian/.cache/bazel/_bazel_brian/efaa4e6bb8c9b0585e183b73359e618d/external/bazel_tools/tools/jdk/BUILD:149:1: no such package '@local_jdk//': Expected directory at /dev/null/nonexistent but it does not exist. and referenced by '@bazel_tools//tools/jdk:bootclasspath' |
@buchgr @meisterT FYI. I think this is exactly the bug I found when we discussed ~2 weeks ago, which Here's the current set of flags and what they do:
AFAIU the proposed fix is to merge the last two and make (@cushon Please correct me if I'm wrong!) |
@philwo that all sounds right to me. If I'm following, the goal should be that |
That sounds like it would work for my use case. Any ETA on implementing it? I'm currently stuck not being able to roll out a new bazel release with other helpful bugfixes and new features due to this. |
cc @buchgr
I'm re-opening this bug to track breaking dependencies on |
instead, read the heads from the configured java runtime, so the values track with changes to --javabase. See bazelbuild#5594 PiperOrigin-RevId: 207759420 Change-Id: I0e5fa6060ea022b62fa8bd7fc427bc308ea61335
…classpath instead of indirecting through javac's bootclasspath handling and attempting to pin to a particular source version. This is a stop-gap until we can just use javac's --release flag. Using the output of DumpPlatformClasspath as the bootclasspath for the default java_toolchain side-steps issues with @local_jdk (see bazelbuild#5744, bazelbuild#5594). PiperOrigin-RevId: 207687432 Change-Id: I1c7996d4aeb96e1ac4996d58115e105854e80127
…ent_java_runtime instead of referencing @local_jdk directly. See bazelbuild#5594 PiperOrigin-RevId: 207670450 Change-Id: I5e0823cfda3563790121443e0f5ca875420ba2fb
…ent_java_runtime instead of referencing @local_jdk directly. See #5594 PiperOrigin-RevId: 207889762
…classpath instead of indirecting through javac's bootclasspath handling and attempting to pin to a particular source version. This is a stop-gap until we can just use javac's --release flag. Using the output of DumpPlatformClasspath as the bootclasspath for the default java_toolchain side-steps issues with @local_jdk (see #5744, #5594). PiperOrigin-RevId: 207890272
instead, read the heads from the configured java runtime, so the values track with changes to --javabase. See #5594 PiperOrigin-RevId: 207894086
…ent_java_runtime instead of referencing @local_jdk directly. See bazelbuild#5594 PiperOrigin-RevId: 207670450 Change-Id: I5e0823cfda3563790121443e0f5ca875420ba2fb
… warnings. The current code with more recent versions of Bazel causes a warning about using the deprecated target '@local_jdk//:java' and to use use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594).
… warnings. The current code with more recent versions of Bazel causes a warning about using the deprecated target '@local_jdk//:java' and to use use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594). Resolves higherkindness#122
… warnings. The current code with more recent versions of Bazel causes a warning about using the deprecated target '@local_jdk//:java' and to use use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594). Resolves higherkindness#122
Includes updating the _java attribute to use current_java_runtime and get rid of warnings. The current code with more recent versions of Bazel causes a warning about using the deprecated target '@local_jdk//:java' and to use use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594). Resolves higherkindness#122
* Update protobuf to remove warning The older version of protobuf is causing a warning like: An illegal reflective access operation has occurred * Bazel 25 compatibility Includes updating the _java attribute to use current_java_runtime and get rid of warnings. The current code with more recent versions of Bazel causes a warning about using the deprecated target '@local_jdk//:java' and to use use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594). Resolves #122 * Update travis images
Fixes #529 With this change, the Bazel build is compatible with all flags listed in #529 (comment) $ bazel build //ijwb:ijwb_bazel_zip --define=ij_product=intellij-latest --incompatible_depset_is_not_iterable --incompatible_depset_is_not_iterable --incompatible_depset_union --incompatible_disable_deprecated_attr_params --incompatible_disable_legacy_cc_provider --incompatible_disallow_legacy_py_provider --incompatible_merge_genfiles_directory --incompatible_new_actions_api --incompatible_use_toolchain_providers_in_java_common INFO: Build option --define has changed, discarding analysis cache. WARNING: /usr/local/google/home/jingwen/code/intellij/java/BUILD:177:1: in java_import rule //java:jdk_tools_jar: target '//java:jdk_tools_jar' depends on deprecated target '@local_jdk//:langtools': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594) INFO: Analyzed target //ijwb:ijwb_bazel_zip (9 packages loaded, 2036 targets configured). INFO: Found 1 target... Target //ijwb:ijwb_bazel_zip up-to-date: bazel-bin/ijwb/ijwb_bazel.zip PiperOrigin-RevId: 249526071
Fixes #529 With this change, the Bazel build is compatible with all flags listed in #529 (comment) $ bazel build //ijwb:ijwb_bazel_zip --define=ij_product=intellij-latest --incompatible_depset_is_not_iterable --incompatible_depset_is_not_iterable --incompatible_depset_union --incompatible_disable_deprecated_attr_params --incompatible_disable_legacy_cc_provider --incompatible_disallow_legacy_py_provider --incompatible_merge_genfiles_directory --incompatible_new_actions_api --incompatible_use_toolchain_providers_in_java_common INFO: Build option --define has changed, discarding analysis cache. WARNING: /usr/local/google/home/jingwen/code/intellij/java/BUILD:177:1: in java_import rule //java:jdk_tools_jar: target '//java:jdk_tools_jar' depends on deprecated target '@local_jdk//:langtools': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594) INFO: Analyzed target //ijwb:ijwb_bazel_zip (9 packages loaded, 2036 targets configured). INFO: Found 1 target... Target //ijwb:ijwb_bazel_zip up-to-date: bazel-bin/ijwb/ijwb_bazel.zip PiperOrigin-RevId: 249526071
Fixes #529 With this change, the Bazel build is compatible with all flags listed in #529 (comment) $ bazel build //ijwb:ijwb_bazel_zip --define=ij_product=intellij-latest --incompatible_depset_is_not_iterable --incompatible_depset_is_not_iterable --incompatible_depset_union --incompatible_disable_deprecated_attr_params --incompatible_disable_legacy_cc_provider --incompatible_disallow_legacy_py_provider --incompatible_merge_genfiles_directory --incompatible_new_actions_api --incompatible_use_toolchain_providers_in_java_common INFO: Build option --define has changed, discarding analysis cache. WARNING: /usr/local/google/home/jingwen/code/intellij/java/BUILD:177:1: in java_import rule //java:jdk_tools_jar: target '//java:jdk_tools_jar' depends on deprecated target '@local_jdk//:langtools': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594) INFO: Analyzed target //ijwb:ijwb_bazel_zip (9 packages loaded, 2036 targets configured). INFO: Found 1 target... Target //ijwb:ijwb_bazel_zip up-to-date: bazel-bin/ijwb/ijwb_bazel.zip PiperOrigin-RevId: 249659976
…azelbuild/intellij PR import #968) This removes the warning when building `//java:fast_build_javac` and `//java:jdk_tools_lib`: ``` $ bazel build //java:jdk_tools_lib //java:fast_build_javac WARNING: /Users/jingwen/code/intellij/java/BUILD:178:1: in java_import rule //java:jdk_tools_jar: target '//java:jdk_tools_jar' depends on deprecated target '@local_jdk//:langtools': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594) ``` Closes #968 PiperOrigin-RevId: 257357318
…azelbuild/intellij PR import #968) This removes the warning when building `//java:fast_build_javac` and `//java:jdk_tools_lib`: ``` $ bazel build //java:jdk_tools_lib //java:fast_build_javac WARNING: /Users/jingwen/code/intellij/java/BUILD:178:1: in java_import rule //java:jdk_tools_jar: target '//java:jdk_tools_jar' depends on deprecated target '@local_jdk//:langtools': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594) ``` Closes #968 PiperOrigin-RevId: 257357318
…azelbuild/intellij PR import #968) This removes the warning when building `//java:fast_build_javac` and `//java:jdk_tools_lib`: ``` $ bazel build //java:jdk_tools_lib //java:fast_build_javac WARNING: /Users/jingwen/code/intellij/java/BUILD:178:1: in java_import rule //java:jdk_tools_jar: target '//java:jdk_tools_jar' depends on deprecated target '@local_jdk//:langtools': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594) ``` Closes #968 PiperOrigin-RevId: 257357318
This removes the warning when building `//java:fast_build_javac` and `//java:jdk_tools_lib`: ``` $ bazel build //java:jdk_tools_lib //java:fast_build_javac WARNING: /Users/jingwen/code/intellij/java/BUILD:178:1: in java_import rule //java:jdk_tools_jar: target '//java:jdk_tools_jar' depends on deprecated target '@local_jdk//:langtools': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594) ``` PiperOrigin-RevId: 257357318
This removes the warning when building `//java:fast_build_javac` and `//java:jdk_tools_lib`: ``` $ bazel build //java:jdk_tools_lib //java:fast_build_javac WARNING: /Users/jingwen/code/intellij/java/BUILD:178:1: in java_import rule //java:jdk_tools_jar: target '//java:jdk_tools_jar' depends on deprecated target '@local_jdk//:langtools': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594) ``` PiperOrigin-RevId: 257357318
This removes the warning when building `//java:fast_build_javac` and `//java:jdk_tools_lib`: ``` $ bazel build //java:jdk_tools_lib //java:fast_build_javac WARNING: /Users/jingwen/code/intellij/java/BUILD:178:1: in java_import rule //java:jdk_tools_jar: target '//java:jdk_tools_jar' depends on deprecated target '@local_jdk//:langtools': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594) ``` PiperOrigin-RevId: 257357318
This removes the warning when building `//java:fast_build_javac` and `//java:jdk_tools_lib`: ``` $ bazel build //java:jdk_tools_lib //java:fast_build_javac WARNING: /Users/jingwen/code/intellij/java/BUILD:178:1: in java_import rule //java:jdk_tools_jar: target '//java:jdk_tools_jar' depends on deprecated target '@local_jdk//:langtools': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594) ``` PiperOrigin-RevId: 257357318
This removes the warning when building `//java:fast_build_javac` and `//java:jdk_tools_lib`: ``` $ bazel build //java:jdk_tools_lib //java:fast_build_javac WARNING: /Users/jingwen/code/intellij/java/BUILD:178:1: in java_import rule //java:jdk_tools_jar: target '//java:jdk_tools_jar' depends on deprecated target '@local_jdk//:langtools': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594) ``` PiperOrigin-RevId: 257387444
This removes the warning when building `//java:fast_build_javac` and `//java:jdk_tools_lib`: ``` $ bazel build //java:jdk_tools_lib //java:fast_build_javac WARNING: /Users/jingwen/code/intellij/java/BUILD:178:1: in java_import rule //java:jdk_tools_jar: target '//java:jdk_tools_jar' depends on deprecated target '@local_jdk//:langtools': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594) ``` PiperOrigin-RevId: 257387444
Fixes bazelbuild#529 With this change, the Bazel build is compatible with all flags listed in bazelbuild#529 (comment) $ bazel build //ijwb:ijwb_bazel_zip --define=ij_product=intellij-latest --incompatible_depset_is_not_iterable --incompatible_depset_is_not_iterable --incompatible_depset_union --incompatible_disable_deprecated_attr_params --incompatible_disable_legacy_cc_provider --incompatible_disallow_legacy_py_provider --incompatible_merge_genfiles_directory --incompatible_new_actions_api --incompatible_use_toolchain_providers_in_java_common INFO: Build option --define has changed, discarding analysis cache. WARNING: /usr/local/google/home/jingwen/code/intellij/java/BUILD:177:1: in java_import rule //java:jdk_tools_jar: target '//java:jdk_tools_jar' depends on deprecated target '@local_jdk//:langtools': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594) INFO: Analyzed target //ijwb:ijwb_bazel_zip (9 packages loaded, 2036 targets configured). INFO: Found 1 target... Target //ijwb:ijwb_bazel_zip up-to-date: bazel-bin/ijwb/ijwb_bazel.zip PiperOrigin-RevId: 249659976
This removes the warning when building `//java:fast_build_javac` and `//java:jdk_tools_lib`: ``` $ bazel build //java:jdk_tools_lib //java:fast_build_javac WARNING: /Users/jingwen/code/intellij/java/BUILD:178:1: in java_import rule //java:jdk_tools_jar: target '//java:jdk_tools_jar' depends on deprecated target '@local_jdk//:langtools': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594) ``` PiperOrigin-RevId: 257387444
Fixes bazelbuild#529 With this change, the Bazel build is compatible with all flags listed in bazelbuild#529 (comment) $ bazel build //ijwb:ijwb_bazel_zip --define=ij_product=intellij-latest --incompatible_depset_is_not_iterable --incompatible_depset_is_not_iterable --incompatible_depset_union --incompatible_disable_deprecated_attr_params --incompatible_disable_legacy_cc_provider --incompatible_disallow_legacy_py_provider --incompatible_merge_genfiles_directory --incompatible_new_actions_api --incompatible_use_toolchain_providers_in_java_common INFO: Build option --define has changed, discarding analysis cache. WARNING: /usr/local/google/home/jingwen/code/intellij/java/BUILD:177:1: in java_import rule //java:jdk_tools_jar: target '//java:jdk_tools_jar' depends on deprecated target '@local_jdk//:langtools': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594) INFO: Analyzed target //ijwb:ijwb_bazel_zip (9 packages loaded, 2036 targets configured). INFO: Found 1 target... Target //ijwb:ijwb_bazel_zip up-to-date: bazel-bin/ijwb/ijwb_bazel.zip PiperOrigin-RevId: 249659976
This removes the warning when building `//java:fast_build_javac` and `//java:jdk_tools_lib`: ``` $ bazel build //java:jdk_tools_lib //java:fast_build_javac WARNING: /Users/jingwen/code/intellij/java/BUILD:178:1: in java_import rule //java:jdk_tools_jar: target '//java:jdk_tools_jar' depends on deprecated target '@local_jdk//:langtools': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594) ``` PiperOrigin-RevId: 257387444
To avoid the following warnings ``` WARNING: /home/aj/.cache/bazel/_bazel_aj/c1e06e2358666d118d0ae50e2d32c25d/external/bazel_tools/tools/jdk/BUILD:124:1: in alias rule @bazel_tools//tools/jdk:jar: target '@bazel_tools//tools/jdk:jar' depends on deprecated target '@local_jdk//:jar': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594) ```
* No longer depend on "@bazel_tools//tools/jdk:jar" To avoid the following warnings ``` WARNING: /home/aj/.cache/bazel/_bazel_aj/c1e06e2358666d118d0ae50e2d32c25d/external/bazel_tools/tools/jdk/BUILD:124:1: in alias rule @bazel_tools//tools/jdk:jar: target '@bazel_tools//tools/jdk:jar' depends on deprecated target '@local_jdk//:jar': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594) ``` * Targets and files should not share names To avoid the warning ``` WARNING: /home/aj/tweag.io/da/da-master/compiler/damlc/tests/BUILD.bazel:316:1: target 'simple-dalf.dalf' is both a rule and a file; please choose another name for the rule ```
* No longer depend on "@bazel_tools//tools/jdk:jar" To avoid the following warnings ``` WARNING: /home/aj/.cache/bazel/_bazel_aj/c1e06e2358666d118d0ae50e2d32c25d/external/bazel_tools/tools/jdk/BUILD:124:1: in alias rule @bazel_tools//tools/jdk:jar: target '@bazel_tools//tools/jdk:jar' depends on deprecated target '@local_jdk//:jar': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see bazelbuild/bazel#5594) ``` * Targets and files should not share names To avoid the warning ``` WARNING: /home/aj/tweag.io/da/da-master/compiler/damlc/tests/BUILD.bazel:316:1: target 'simple-dalf.dalf' is both a rule and a file; please choose another name for the rule ```
copying jdk tools.jar introduced bugs. refer to, bazelbuild/intellij#2164 |
Description of the problem / feature request:
Since 849df36, bazel will always pick up a JDK from
which javac
or $JAVA_HOME in preference to an embedded one for@local_jdk//
. I want to always use the embedded one instead. A startup option to do this would be fine.Feature requests: what underlying problem are you trying to solve with this feature?
I version the bazel binary in my repository. I want this to fix the version of the JDK being used too, like it did before.
What operating system are you running Bazel on?
Debian Jessie amd64
What's the output of
bazel info release
?release 0.15.0-peloton-201807111305+9c52124
This is 0.15.0 with a few local patches that aren't relevant.
Have you found anything relevant by searching the web?
@cushon changed this.
The text was updated successfully, but these errors were encountered: