Skip to content

Commit

Permalink
Add test and address reviewr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorcloudy committed Jul 22, 2019
1 parent efa07a8 commit 5fc3588
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/test/shell/bazel/bazel_java_tools_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,36 @@ EOF
bazel build @local_java_tools//:toolchain || fail "toolchain failed to build"
}

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

run_suite "Java tools archive tests"
4 changes: 4 additions & 0 deletions third_party/ijar/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ cc_library(
"//src:__subpackages__",
"//third_party/ijar:__subpackages__",
"//tools/test:__pkg__",
# TODO(bazel-team): Move this target out of @bazel_tools
"@local_java_tools//:__pkg__",
"@remote_java_tools_linux//:__pkg__",
"@remote_java_tools_darwin//:__pkg__",
"@remote_java_tools_windows//:__pkg__",
],
deps = [
":platform_utils",
Expand Down

0 comments on commit 5fc3588

Please sign in to comment.