-
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
Windows: fix ijar compilation from ext.repo #8742
Conversation
//src/main/native/windows:lib-file and //src/main/native/windows:lib-util were merged into one rule some time ago. This commit merges the copies of those libraries in tools/jdk/BUILD accordingly. Fixes bazelbuild#8614
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add the following two test cases to src/test/shell/bazel/bazel_java_tools_test.sh
function test_java_tools_singlejar_builds() {
local java_tools_rlocation=$(rlocation io_bazel/src/java_tools_${JAVA_TOOLS_JAVA_VERSION}.zip)
local java_tools_zip_file_url="file://${java_tools_rlocation}"
if "$is_windows"; then
java_tools_zip_file_url="file:///${java_tools_rlocation}"
fi
cat >WORKSPACE <<EOF
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "local_java_tools",
urls = ["${java_tools_zip_file_url}"]
)
EOF
bazel build @local_java_tools//:singlejar_cc_bin || fail "singlejar failed to build"
}
function test_java_tools_ijar_builds() {
local java_tools_rlocation=$(rlocation io_bazel/src/java_tools_${JAVA_TOOLS_JAVA_VERSION}.zip)
local java_tools_zip_file_url="file://${java_tools_rlocation}"
if "$is_windows"; then
java_tools_zip_file_url="file:///${java_tools_rlocation}"
fi
cat >WORKSPACE <<EOF
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "local_java_tools",
urls = ["${java_tools_zip_file_url}"]
)
EOF
bazel build @local_java_tools//:ijar_cc_binary || fail "ijar failed to build"
}
They should test it fixes #8614.
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for fixing this!!
The test fails because
Unfortunately on Windows we must expect this error because every action runs in the one and only execroot and they all share it, so all inputs are visible to every action. (There's no sandboxing yet.) |
Change-Id: Idd10b6c86b70c40b623a9373ba29b1a428e0aa12
My latest change didn't fix the test on Windows. The problem is that At this point I'm giving up and abandoning this PR, because I don't know how to fix this without sandboxing. |
@iirina After #8950, building ijar and singlejar fail on Windows due to header check mentioned here by @laszlocsomor .
This is actually not true, the rule is not depending on anything under @bazel_tools, but |
…emoving dependency on @bazel_tools//tools/cpp:malloc As @laszlocsomor [explained](#8742 (comment) ), building `ijar_cc_binary` and `singlejar_cc_bin` on Windows (where sandbox is not available yet) will have header conflict due to the same headers are shipped in both @bazel_tools and @local_java_tools. `ijar_cc_binary` and `singlejar_cc_bin` only declare headers in @local_java_tools as dependency, but it will search `external/bazel_tools` first because every cc targets depend on `@bazel_tools//tools/cpp:malloc` [implicitly](https://docs.bazel.build/versions/master/be/c-cpp.html#cc_binary). This change remove the dependency on `@bazel_tools//tools/cpp:malloc` to avoid this confusion. Closes #8954. PiperOrigin-RevId: 259519714
//src/main/native/windows:lib-file and
//src/main/native/windows:lib-util were merged
into one rule some time ago.
This commit merges the copies of those libraries
in tools/jdk/BUILD accordingly.
Fixes #8614