diff options
author | Xin Gao <xingao@google.com> | 2017-06-21 17:13:23 +0200 |
---|---|---|
committer | Philipp Wollermann <philwo@google.com> | 2017-06-22 11:55:28 +0200 |
commit | 33d05f6b551cf2fdb257cb536a5e864d095144a1 (patch) | |
tree | 166729a7b64ef00b44004d4dd2cd7e462e47648b /src | |
parent | 524b90d9e5acc4fa568f215c9415eaa902e979f8 (diff) |
Make source code of singlejar and ijar available from @bazel_tools. ,
Please refer to patch set 9 and its CI run for usage and test
results. In practice, users should create their own java_toolchain
rule in their project's BUILD file, and set the two attributes like
above instead of modifying //tools/jdk/BUILD.
Change-Id: Ic880f243086b00a58d453a8139ba4c957fe54bc7
PiperOrigin-RevId: 159694649
Diffstat (limited to 'src')
-rw-r--r-- | src/BUILD | 6 | ||||
-rw-r--r-- | src/BUILD.tools | 23 | ||||
-rw-r--r-- | src/main/cpp/util/BUILD | 6 | ||||
-rw-r--r-- | src/main/native/BUILD | 9 | ||||
-rwxr-xr-x | src/test/shell/integration/java_integration_test.sh | 13 | ||||
-rw-r--r-- | src/tools/singlejar/BUILD | 24 |
6 files changed, 79 insertions, 2 deletions
@@ -126,6 +126,7 @@ filegroup( [genrule( name = "embedded_tools" + suffix, srcs = [ + "BUILD.tools", ":create_embedded_tools.sh", "//tools:embedded_tools_srcs", "//third_party:gpl-srcs", @@ -140,6 +141,9 @@ filegroup( "//src/tools/android/java/com/google/devtools/build/android/idlclass:embedded_tools", "//src/tools/android/java/com/google/devtools/build/android/dexer:embedded_tools", "//src/tools/android/java/com/google/devtools/build/android/ziputils:embedded_tools", + "//src/tools/singlejar:embedded_tools", + "//src/main/cpp/util:embedded_tools", + "//src/main/native:embedded_tools", "//src/main/protobuf:srcs", "//src/java_tools/buildjar:JavaBuilderDeploy", "//src/java_tools/buildjar:VanillaJavaBuilder_deploy.jar", @@ -148,7 +152,9 @@ filegroup( "//src/java_tools/junitrunner/java/com/google/testing/junit/runner:ExperimentalRunner_deploy.jar", "//src/java_tools/junitrunner/java/com/google/testing/coverage:embedded_tools", "//third_party/ijar", + "//third_party/ijar:embedded_tools", "//third_party/java/jacoco:srcs", + "//third_party/zlib:embedded_tools", ] + select({ ":darwin": [ ":darwin_tools", diff --git a/src/BUILD.tools b/src/BUILD.tools new file mode 100644 index 0000000000..d4e0a4164c --- /dev/null +++ b/src/BUILD.tools @@ -0,0 +1,23 @@ +config_setting( + name = "freebsd", + values = {"cpu": "freebsd"}, + visibility = ["//visibility:public"], +) + +config_setting( + name = "windows", + values = {"cpu": "x64_windows"}, + visibility = ["//visibility:public"], +) + +config_setting( + name = "windows_msvc", + values = {"cpu": "x64_windows_msvc"}, + visibility = ["//visibility:public"], +) + +config_setting( + name = "windows_msys", + values = {"cpu": "x64_windows_msys"}, + visibility = ["//visibility:public"], +) diff --git a/src/main/cpp/util/BUILD b/src/main/cpp/util/BUILD index 6bd3b44488..b595ccb571 100644 --- a/src/main/cpp/util/BUILD +++ b/src/main/cpp/util/BUILD @@ -146,3 +146,9 @@ filegroup( srcs = glob(["**"]), visibility = ["//src/main/cpp:__pkg__"], ) + +filegroup( + name = "embedded_tools", + srcs = glob(["*.cc"]) + glob(["*.h"]) + ["BUILD"], + visibility = ["//visibility:public"], +) diff --git a/src/main/native/BUILD b/src/main/native/BUILD index 653b595ad2..3799a109cf 100644 --- a/src/main/native/BUILD +++ b/src/main/native/BUILD @@ -108,3 +108,12 @@ filegroup( srcs = glob(["**"]), visibility = ["//src:__pkg__"], ) + +# TODO(laszlocsomor): move the common parts needed both by the Windows JNI lib +# and the Bazel client into a separate library, and only copy those to the +# embedded tools folder. +filegroup( + name = "embedded_tools", + srcs = glob(["*.cc"]) + glob(["*.h"]) + ["BUILD"], + visibility = ["//visibility:public"], +) diff --git a/src/test/shell/integration/java_integration_test.sh b/src/test/shell/integration/java_integration_test.sh index e86e90a926..7c4f5d250f 100755 --- a/src/test/shell/integration/java_integration_test.sh +++ b/src/test/shell/integration/java_integration_test.sh @@ -304,8 +304,14 @@ function test_deterministic_nostamp_build() { bazel clean || fail "Clean failed" bazel build --nostamp //$pkg/java/hello:hello_deploy.jar \ || fail "Build failed" + # TODO(bazel-team) .a files (C/C++ static library file generated by + # archive tool) on darwin OS only are not deterministic. + # https://github.com/bazelbuild/bazel/issues/3156 local -r first_run="$(md5_file $(find "${PRODUCT_NAME}-out/" -type f '!' \ - -name build-changelist.txt -a '!' -name volatile-status.txt | sort -u))" + -name build-changelist.txt -a '!' -name volatile-status.txt \ + -a '!' -name stderr-* -a '!' -name *.a \ + -a '!' -name __xcodelocatorcache -a '!' -name __xcruncache \ + | sort -u))" sleep 1 # Ensure the timestamp change between builds. @@ -313,7 +319,10 @@ function test_deterministic_nostamp_build() { bazel build --nostamp //$pkg/java/hello:hello_deploy.jar \ || fail "Build failed" local -r second_run="$(md5_file $(find "${PRODUCT_NAME}-out/" -type f '!' \ - -name build-changelist.txt -a '!' -name volatile-status.txt | sort -u))" + -name build-changelist.txt -a '!' -name volatile-status.txt \ + -a '!' -name stderr-* -a '!' -name *.a \ + -a '!' -name __xcodelocatorcache -a '!' -name __xcruncache \ + | sort -u))" assert_equals "$first_run" "$second_run" } diff --git a/src/tools/singlejar/BUILD b/src/tools/singlejar/BUILD index 7ca5ffa8ff..35b0c50e3b 100644 --- a/src/tools/singlejar/BUILD +++ b/src/tools/singlejar/BUILD @@ -17,6 +17,29 @@ filegroup( visibility = ["//src:__pkg__"], ) +filegroup( + name = "embedded_tools", + srcs = [ + "BUILD", + "combiners.cc", + "combiners.h", + "diag.h", + "input_jar.cc", + "input_jar.h", + "mapped_file.h", + "options.cc", + "options.h", + "output_jar.cc", + "output_jar.h", + "singlejar_main.cc", + "token_stream.h", + "transient_bytes.h", + "zip_headers.h", + "zlib_interface.h", + ], + visibility = ["//visibility:public"], +) + cc_binary( name = "singlejar", srcs = [ @@ -27,6 +50,7 @@ cc_binary( "//conditions:default": [], }), linkstatic = 1, + visibility = ["//visibility:public"], deps = [ "options", "output_jar", |