Skip to content

Incompatibility with rules_java 8.12.0 #1741

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

Open
rafikk opened this issue May 24, 2025 · 1 comment · May be fixed by #1745
Open

Incompatibility with rules_java 8.12.0 #1741

rafikk opened this issue May 24, 2025 · 1 comment · May be fixed by #1745
Assignees

Comments

@rafikk
Copy link

rafikk commented May 24, 2025

Hello! I’m testing my repo against rules_java 8.12.0 with rules_scala 7.0.0, and running into the following build error on scala_specs2_junit_test targets:

Traceback (most recent call last):
	File "/private/var/tmp/_bazel_rafiksalama/1d5a93ad130d5a2bb2604b5c76cd5ad7/external/rules_java+/java/bazel/rules/bazel_java_import.bzl", line 25, column 34, in _proxy
		return bazel_java_import_rule(
	File "/private/var/tmp/_bazel_rafiksalama/1d5a93ad130d5a2bb2604b5c76cd5ad7/external/rules_java+/java/common/rules/impl/bazel_java_import_impl.bzl", line 129, column 28, in bazel_java_import_rule
		_check_empty_jars_error(ctx, jars)
	File "/private/var/tmp/_bazel_rafiksalama/1d5a93ad130d5a2bb2604b5c76cd5ad7/external/rules_java+/java/common/rules/impl/bazel_java_import_impl.bzl", line 75, column 13, in _check_empty_jars_error
		fail("empty java_import.jars is not supported " + ctx.label.package)
Error in fail: empty java_import.jars is not supported specs2

The @rules_scala//specs2:specs2 target indeed specifies an empty jars attribute. Adding --noincompatible_disallow_java_import_empty_jars to bazelrc doesn’t seem to help, so this appears to be a hard incompatibility.

cc @mbland

@mbland
Copy link
Contributor

mbland commented May 24, 2025

Other relevant information provided by @rafikk from the original #scala thread in the Bazel Slack workspace:

--noincompatible_disallow_java_import_empty_jars actually doesn't help, and the change in rules_java calls this out. so it looks like this is a hard incompatibity between latest rules_java and rules_scala 7.0.0

I think I have an idea how to fix this, and I was planning to open a pull request to bump versions anyway. Feel free to assign this to me.

mbland added a commit to mbland/rules_scala that referenced this issue May 26, 2025
Updates a few dependencies, enables `release_prep.sh` to handle tags
with or without a `v` prefix, and updates `//specs2:specs2` for
`rules_java` 8.12.0. Fixes bazel-contrib#1741.

- Go: 1.24.2 => 1.24.3
- `google-common-protos`: 2.55.3 => 2.57.0
- `jline`: 3.29.0 => 3.30.3
- `protobuf`: 30.2 => 31.0
- `protobuf-java`: 4.30.2 => 4.31.0
- `rules_go`: 0.54.0 => 0.54.1
- `rules_java`: 8.11.0 => 8.12.0
- `rules_python`: 1.4.0 => 1.4.1
- `util-interface`: 1.10.11 => 1.11.0

Also:

- Touches up `test_reproducibility.sh` slightly and fixes documentation
  errors pointed out privately by @gergelyfabian.

- Updates `test_scala_import_source_jar.sh` to use `bazel query` to get
  the repo path. This became necessary because switching from Bzlmod
  runs to `WORKSPACE` would break, and removing the repo caused the
  `last_green` Bazel to break.

- Adds `bazel_features_deps()` to `WORKSPACE` and a commented out
  `--repositories_without_autoloads` line to `.bazelrc` for `rules_java`
  8.12.0 `WORKSPACE` builds.
mbland added a commit to mbland/rules_scala that referenced this issue May 27, 2025
Updates a few dependencies, enables `release_prep.sh` to handle tags
with or without a `v` prefix, and updates `//specs2:specs2` for
`rules_java` 8.12.0. Fixes bazel-contrib#1741.

- Go: 1.24.2 => 1.24.3
- `google-common-protos`: 2.55.3 => 2.57.0
- `jline`: 3.29.0 => 3.30.3
- `protobuf`: 30.2 => 31.0
- `protobuf-java`: 4.30.2 => 4.31.0
- `rules_go`: 0.54.0 => 0.54.1
- `rules_java`: 8.11.0 => 8.12.0
- `rules_python`: 1.4.0 => 1.4.1
- `util-interface`: 1.10.11 => 1.11.0

Also:

- Touches up `test_reproducibility.sh` slightly and fixes documentation
  errors pointed out privately by @gergelyfabian.

- Updates `test_scala_import_source_jar.sh` to use `bazel query` via the
  new `target_file_location` helper to get the srcjar path.

- Renames `_print_error_msg` to `fail` in `test_helper.sh` and updates
  it to return nonzero.

- Adds `bazel_features_deps()` to `WORKSPACE` and a commented out
  `--repositories_without_autoloads` line to `.bazelrc` for `rules_java`
  8.12.0 `WORKSPACE` builds.

---

This is to keep dependencies up to date with the latest versions.

Updating `test_scala_import_source_jar.sh` to use `bazel query` became
necessary because:

- Switching from running under Bzlmod to running under `WORKSPACE` would
  break.

- Removing the repo to force it to regenerate caused `last_green` Bazel
  runs to break. This wouldn't only break this test, but it broke _all_
  tests until running `bazel clean --expunge`. `last_green` Bazel seems
  to hold onto state, even across `bazel shutdown`, such that it doesn't
  notice that it needs to regenerate a deleted repo.
@mbland mbland linked a pull request May 27, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants