Skip to content
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

--incompatible_load_java_rules_from_bzl breaks some bazel_tools BUILD files #10839

Closed
cpovirk opened this issue Feb 21, 2020 · 13 comments
Closed
Labels
team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website team-Rules-Java Issues for Java rules untriaged

Comments

@cpovirk
Copy link
Contributor

cpovirk commented Feb 21, 2020

ERROR: .../external/bazel_tools/src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps/BUILD:3:1: in java_import rule @bazel_tools//src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps:import_deps_checker_deploy_jar: The native Java rules are deprecated. Please load java_import from the rules_java repository. See http://github.com/bazelbuild/rules_java and https://github.com/bazelbuild/bazel/issues/8741. You can temporarily bypass this error by setting --incompatible_load_java_rules_from_bzl=false.
ERROR: .../external/bazel_tools/src/tools/android/java/com/google/devtools/build/android/BUILD:3:1: in java_import rule @bazel_tools//src/tools/android/java/com/google/devtools/build/android:all_android_tools: The native Java rules are deprecated. Please load java_import from the rules_java repository. See http://github.com/bazelbuild/rules_java and https://github.com/bazelbuild/bazel/issues/8741. You can temporarily bypass this error by setting --incompatible_load_java_rules_from_bzl=false.
ERROR: .../external/bazel_tools/tools/android/BUILD:261:1: in java_binary rule @bazel_tools//tools/android:dexer: The native Java rules are deprecated. Please load java_binary from the rules_java repository. See http://github.com/bazelbuild/rules_java and https://github.com/bazelbuild/bazel/issues/8741. You can temporarily bypass this error by setting --incompatible_load_java_rules_from_bzl=false.

Similar issues about other files that are currently open:

kluever pushed a commit to google/bazel-common that referenced this issue Feb 23, 2020
Fixes #97
Progress toward google/flogger#122

I have also tested this against Flogger and Dagger (modified to fix their own --incompatible_load_java_rules_from_bzl problems). Everything appears to work except for Dagger, which has some breakages from bazel_tools itself, for which I have filed bazelbuild/bazel#10839. (This is in addition to filing and working around bazelbuild/bazel#10838.)

It also includes an upgrade to rules_kotlin to contain the analogous fix for that repo: bazelbuild/rules_kotlin@186c1e1

And ditto for protobuf.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=296727595
kluever pushed a commit to google/bazel-common that referenced this issue Feb 23, 2020
Fixes #97
Progress toward google/flogger#122

I have also tested this against Flogger and Dagger (modified to fix their own --incompatible_load_java_rules_from_bzl problems). Everything appears to work except for Dagger, which has some breakages from bazel_tools itself, for which I have filed bazelbuild/bazel#10839. (This is in addition to filing and working around bazelbuild/bazel#10838.)

It also includes an upgrade to rules_kotlin to contain the analogous fix for that repo: bazelbuild/rules_kotlin@186c1e1

And ditto for protobuf.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=296727595
@aiuto aiuto added team-Rules-Java Issues for Java rules untriaged labels Feb 24, 2020
@cpovirk
Copy link
Contributor Author

cpovirk commented Feb 26, 2020

I started looking at this, and I'm confused.

(First, I should have mentioned that I'm testing with Bazel 2.1.1.)

I see changes to add load() where needed for the first 2 files:

(tools/android/BUILD is still missing load() as I look at it today, but setting that aside for a moment....)

But I don't see the load() statements in the corresponding files under $HOME/.cache/bazel/_bazel_cpovirk/.../external/bazel_tools.

I would have assumed that create_embedded_tools packages the current contents of bazel_tools into each Bazel release, but I don't actually have any idea.

@cpovirk
Copy link
Contributor Author

cpovirk commented Feb 26, 2020

(tools/android/BUILD is still missing load() as I look at it today, but setting that aside for a moment....)

Err, sorry, the current version of tools/android/BUILD no longer uses java_binary and java_import, so it has no need for the load().

It's sounding like this is "fixed" by a4de484 and whichever commit removed the java_* usages from tools/android/BUILD. But a4de484 was 6 months ago, so I'm wondering if it's expected that it seems not to have made its way into the version of bazel_tools that I'm seeing.

cpovirk added a commit to google/dagger that referenced this issue Feb 28, 2020
Sorry for missing these in CL 297608393.

(But note that, even after this CL, there is still a breakage when building Dagger with --incompatible_load_java_rules_from_bzl. I'm trying to get to the bottom of it in bazelbuild/bazel#10839.)

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=297822279
cpovirk added a commit to google/dagger that referenced this issue Feb 28, 2020
Sorry for missing these in CL 297608393.

(But note that, even after this CL, there is still a breakage when building Dagger with --incompatible_load_java_rules_from_bzl. I'm trying to get to the bottom of it in bazelbuild/bazel#10839.)

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=297822279
@cpovirk
Copy link
Contributor Author

cpovirk commented Feb 28, 2020

Here's specifically what I'm seeing in case there's something weird about my environment or project:

$ bazel --version
bazel 2.1.1

$ git clone git@github.com:google/dagger.git && cd dagger && git co 12e9593a7dfce489b5f62748a7427defc3e68658 && bazel build --incompatible_load_java_rules_from_bzl -k //...
...
ERROR: .../5ee40ee7992de43c092e33a2e7d112f4/external/bazel_tools/src/tools/android/java/com/google/devtools/build/android/BUILD:3:1: in java_import rule @bazel_tools//src/tools/android/java/com/google/devtools/build/android:all_android_tools: The native Java rules are deprecated. Please load java_import from the rules_java repository. See http://github.com/bazelbuild/rules_java and https://github.com/bazelbuild/bazel/issues/8741. You can temporarily bypass this error by setting --incompatible_load_java_rules_from_bzl=false.
ERROR: .../5ee40ee7992de43c092e33a2e7d112f4/external/bazel_tools/src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps/BUILD:3:1: in java_import rule @bazel_tools//src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps:import_deps_checker_deploy_jar: The native Java rules are deprecated. Please load java_import from the rules_java repository. See http://github.com/bazelbuild/rules_java and https://github.com/bazelbuild/bazel/issues/8741. You can temporarily bypass this error by setting --incompatible_load_java_rules_from_bzl=false.
...

Note that there are additional errors from running without an Android SDK. But even when I run with the SDK present (at which point the other errors go away), the java_* errors persist. (To make the errors go away (and to get the other error about @bazel_tools//tools/android:dexer), you need to run the build with ANDROID_HOME pointing to an appropriately prepared Android SDK.)

@cpovirk
Copy link
Contributor Author

cpovirk commented Feb 28, 2020

(I thought perhaps that switching to rules_android would help, but it appears not, assuming that I got it right.)

@cpovirk
Copy link
Contributor Author

cpovirk commented Mar 3, 2020

I tried with 2.2.0 and on another machine, and the build still fails.

@cpovirk
Copy link
Contributor Author

cpovirk commented Apr 8, 2020

Also failing with 3.0.0.

@aiuto aiuto added team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website and removed team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website labels Apr 9, 2020
@cpovirk
Copy link
Contributor Author

cpovirk commented May 4, 2020

Ditto 3.1.0.

@aiuto
Copy link
Contributor

aiuto commented May 4, 2020

/cc @iirina Any thoughts? You own #8746

@cpovirk
Copy link
Contributor Author

cpovirk commented Jul 13, 2020

I'm still seeing some errors with 3.3.1. Testing against google/dagger@f3ff00a (which has some other errors related to --incompatible_load_java_rules_from_bzl nowadays, as I've stopped trying to keep it up to date), I see at least 2 of the original 3:

.../7cee73372ad52c17db7b6117de5a4f21/external/bazel_tools/src/tools/android/java/com/google/devtools/build/android/BUILD:3:12: in java_import rule @bazel_tools//src/tools/android/java/com/google/devtools/build/android:all_android_tools: The native Java rules are deprecated....
.../7cee73372ad52c17db7b6117de5a4f21/external/bazel_tools/src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps/BUILD:3:12: in java_import rule @bazel_tools//src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps:import_deps_checker_deploy_jar: The native Java rules are deprecated....

@aiuto aiuto added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jul 14, 2020
@aiuto
Copy link
Contributor

aiuto commented Jul 14, 2020

cc/ @meteorcloudy - because they have lots of recent experience with third party things.

I finally caught a detail in the first entry "ERROR: .../external/bazel_tools/tools/android/BUILD:261:1: in java_binary rule @bazel_tools//tools/android:dexer"

Since it is in bazel_tools, it may be that we need to update an upstream dependency to get there. This might be a build & packaging problem more than a java rules problem.

@meteorcloudy
Copy link
Member

Sorry, the incompatible change is not currently owned by anyone. I'll take a look as soon as I have some free time.

@cpovirk
Copy link
Contributor Author

cpovirk commented Aug 10, 2020

I think this is expected, but FYI, I do still see this with 3.4.1:

ERROR: .../7cee73372ad52c17db7b6117de5a4f21/external/bazel_tools/src/tools/android/java/com/google/devtools/build/android/BUILD:3:12: in java_import rule @bazel_tools//src/tools/android/java/com/google/devtools/build/android:all_android_tools: The native Java rules are deprecated. Please load java_import from the rules_java repository. See http://github.com/bazelbuild/rules_java and #8741. You can temporarily bypass this error by setting --incompatible_load_java_rules_from_bzl=false.
ERROR: .../7cee73372ad52c17db7b6117de5a4f21/external/bazel_tools/src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps/BUILD:3:12: in java_import rule @bazel_tools//src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps:import_deps_checker_deploy_jar: The native Java rules are deprecated. Please load java_import from the rules_java repository. See http://github.com/bazelbuild/rules_java and #8741. You can temporarily bypass this error by setting --incompatible_load_java_rules_from_bzl=false.

@lberki
Copy link
Contributor

lberki commented Oct 5, 2020

This is obsolete; We gave up on --incomplete_load_java_rules_from_bzl.

@lberki lberki closed this as completed Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website team-Rules-Java Issues for Java rules untriaged
Projects
None yet
Development

No branches or pull requests

4 participants