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

fix (build): Disable nojava_header_compilation workaround #452

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# https://www.shellcheck.net/wiki/SC1091
external-sources=true
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.

# https://registry.bazel.build/modules/rules_java
bazel_dep(name = "rules_java", version = "7.3.2")
bazel_dep(name = "rules_java", version = "7.4.0")

# https://github.com/bazelbuild/rules_jvm_external/blob/master/docs/bzlmod.md#installation
# When bumping the version here, must always run: REPIN=1 bazel run @unpinned_maven//:pin
Expand Down
250 changes: 125 additions & 125 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions enola
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ fi

cd "$ROOT"
LOG=$(mktemp)
# TODO Remove --nojava_header_compilation when https://github.com/bazelbuild/bazel/issues/21119 is fixed
if "$BZL" build --nojava_header_compilation --color=yes //cli:enola_deploy.jar >"$LOG" 2>&1 ; then
if "$BZL" build --color=yes //cli:enola_deploy.jar >"$LOG" 2>&1 ; then
rm "$LOG"
# TODO Integrate this with (use) tools/distro/build.sh instead of launching it like this
cd "$CWD" && java --enable-preview -jar "$ROOT"/bazel-bin/cli/enola_deploy.jar "$@"
Expand Down
3 changes: 1 addition & 2 deletions test.bash
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ fi

# https://github.com/bazelbuild/bazel/issues/4257
echo $ Bazel testing...
# TODO Remove --nojava_header_compilation when https://github.com/bazelbuild/bazel/issues/21119 is fixed
"$BZL" query //... | xargs "$BZL" test --nojava_header_compilation
"$BZL" query //... | xargs "$BZL" test

# The following makes sure that this test.bash will run as a pre-commit hook.
# NB: We DO NOT want to "pre-commit install" because that won't run bazelisk!
Expand Down
3 changes: 1 addition & 2 deletions tools/distro/build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ set -euox pipefail

# Build the end-user distributed executable fat über JAR
# NB: "bazelisk build //..." does *NOT* build "//cli:enola_deploy.jar", for some reason
# TODO Remove --nojava_header_compilation when https://github.com/bazelbuild/bazel/issues/21119 is fixed
bazelisk build --nojava_header_compilation //cli:enola_deploy.jar
bazelisk build //cli:enola_deploy.jar
cp tools/distro/execjar-header.bash site/download/latest/enola
cat bazel-bin/cli/enola_deploy.jar >>site/download/latest/enola

Expand Down
1 change: 0 additions & 1 deletion tools/hello/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ java_binary(
deps = [":hello_lib"],
)

# https://github.com/bazelbuild/bazel/issues/21119
java_library(
name = "hello_lib",
srcs = ["src/main/java/dev/enola/common/hello/Library.java"],
Expand Down
4 changes: 0 additions & 4 deletions tools/hello/src/main/java/dev/enola/common/hello/Library.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@

public class Library {
public static String helloWithJavaStringTemplate(String planet) {
// https://github.com/bazelbuild/bazel/issues/21119
// TODO Make "bazelisk run //tools/hello" work!
// Only "bazelisk run --nojava_header_compilation //tools/hello" works.
return STR."hello, \{planet}";
// return "hello, " + planet;
}
}
1 change: 0 additions & 1 deletion tools/java_toolchain/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# https://github.com/bazelbuild/bazel/issues/21119
# https://bazel.build/docs/bazel-and-java#config-compilation-toolchains

# NB: This is "activated" by register_toolchains() in WORKSPACE.bazel!
Expand Down
1 change: 0 additions & 1 deletion web/ui/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ java_library(
name = "ui",
srcs = glob(["src/main/java/**/*.java"]),
# for String Templates in Java 21
# but still NOK due to https://github.com/bazelbuild/bazel/issues/21119 :-()
# TODO Why can this not be removed, now that there is a tools/java_toolchain/BUILD with "--enable_preview"?
javacopts = ["--enable-preview"],
resources = glob(["src/main/resources/**/*"]),
Expand Down