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

extra javac opts should override default ones #1613

Merged
merged 2 commits into from
Sep 11, 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
3 changes: 1 addition & 2 deletions scala/private/rule_impls.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,9 @@ def compile_java(ctx, source_jars, source_files, output, extra_javac_opts, provi
output = output,
javac_opts = expand_location(
ctx,
extra_javac_opts +
java_common.default_javac_opts(
java_toolchain = java_toolchain,
),
) + extra_javac_opts,
),
deps = providers_of_dependencies,
#exports can be empty since the manually created provider exposes exports
Expand Down
8 changes: 8 additions & 0 deletions test/shell/test_toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,13 @@ java_toolchain_javacopts_are_used(){
--verbose_failures //test_expect_failure/compilers_javac_opts:can_configure_jvm_flags_for_javac_via_javacopts
}

java_toolchain_javacopts_can_be_overridden(){
action_should_fail_with_message \
"invalid target release: InvalidTarget" \
build \
--verbose_failures //test_expect_failure/compilers_javac_opts:can_override_default_toolchain_flags_for_javac_via_javacopts
}

$runner test_scalaopts_from_scala_toolchain
$runner java_toolchain_javacopts_are_used
$runner java_toolchain_javacopts_can_be_overridden
6 changes: 6 additions & 0 deletions test_expect_failure/compilers_javac_opts/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ scala_library(
name = "can_configure_jvm_flags_for_javac_via_javacopts",
srcs = ["WillNotCompileSinceJavaToolchainAddsAnInvalidJvmFlag.java"],
)

scala_library(
name = "can_override_default_toolchain_flags_for_javac_via_javacopts",
srcs = ["WillNotCompileSinceJavaToolchainAddsAnInvalidJvmFlag.java"],
javacopts = ["-target InvalidTarget"],
)