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

Depend on @bazel_tools//third_party/ijar:zip from java_tools #8945

Closed
wants to merge 2 commits into from

Conversation

meteorcloudy
Copy link
Member

Fixes #8614

Copy link
Contributor

@iirina iirina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Yun, this is great!

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"
}

@@ -30,6 +30,7 @@ cc_library(
"//src:__subpackages__",
"//third_party/ijar:__subpackages__",
"//tools/test:__pkg__",
"@local_java_tools//:__pkg__",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is enough. It's enough for the tests to pass. The remote repo names in the workspace suffix are "remote_java_tools_linux", "remote_java_tools_windows" and "remote_java_tools_darwin". Can you please add them as well? Also add a TODO to migrate this target out of bazel_tools.

@meteorcloudy
Copy link
Member Author

@iirina Thanks! I added tests and extra targets.

@meteorcloudy
Copy link
Member Author

I'm not quite sure the test will pass because of

load("@rules_cc//cc:defs.bzl", "cc_library", "cc_binary", "cc_proto_library")
load("@rules_java//java:defs.bzl", "java_toolchain", "java_import", "java_binary")

We didn't declare rules_cc and rules_java anywhere in the WORKSPACE file.

@iirina
Copy link
Contributor

iirina commented Jul 22, 2019

Thanks @meteorcloudy! @rules_java and @rules_cc are declared in the implicit workspace suffix:

maybe(
http_archive,
"rules_java",
sha256 = "bc81f1ba47ef5cc68ad32225c3d0e70b8c6f6077663835438da8d5733f917598",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_java/archive/7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip",
"https://github.com/bazelbuild/rules_java/archive/7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip"
],
strip_prefix = "rules_java-7cf3cefd652008d0a64a419c34c13bdca6c8f178"
)
# Needed only because of java_tools.
maybe(
http_archive,
"rules_cc",
sha256 = "36fa66d4d49debd71d05fba55c1353b522e8caef4a20f8080a3d17cdda001d89",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/0d5f3f2768c6ca2faca0079a997a97ce22997a0c.zip",
"https://github.com/bazelbuild/rules_cc/archive/0d5f3f2768c6ca2faca0079a997a97ce22997a0c.zip"
],
strip_prefix = "rules_cc-0d5f3f2768c6ca2faca0079a997a97ce22997a0c",
)

@meteorcloudy
Copy link
Member Author

Building singlejar_cc_bin fails on all platform, looks like this is not a Windows only problem.

@iirina
Copy link
Contributor

iirina commented Jul 22, 2019

Thanks @meteorcloudy. This is something new, the tools were building before... Let me see what changed :(

@meteorcloudy
Copy link
Member Author

OK, thanks for checking!

@iirina
Copy link
Contributor

iirina commented Jul 23, 2019

@meteorcloudy f5a6ee1 fixed the tests on the other platforms. Can you rebase and remove the lines that skip the tests on Windows?

if "$is_windows"; then
echo "Skipping test on Windows." && return
fi

and

if "$is_windows"; then
echo "Skipping test on Windows." && return
fi

@meteorcloudy
Copy link
Member Author

Found a better fix at #8954, please take a look ;)

@meteorcloudy
Copy link
Member Author

Closing due to #8954

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

java_tools' ijar and singlejar don't build on windows
3 participants