diff options
author | philwo <philwo@google.com> | 2017-04-28 17:51:22 +0200 |
---|---|---|
committer | Vladimir Moskva <vladmos@google.com> | 2017-04-28 18:33:30 +0200 |
commit | 6f7066e3112315d259c00d5b68330a326391ec31 (patch) | |
tree | b0f860baefa4d74dccc5cd4db0c58c78e18536ef | |
parent | 2541fd93287ff135c3348a3986cea7dfc8444f71 (diff) |
Bundled JDK changes for the release process. This is a fixed version
that should not break CI this time...
- Make the default Bazel release artifacts include the bundled JDK.
- Create additional Bazel release artifacts without a bundled JDK.
Tested by running "bazel build //scripts/..." in a clean checkout and
one with this patch in, then diffing the entire bazel-out folder and
manually inspecting the resulting files (zips, tar.gz, deb, rpm) to make
sure that they contain the right files. Looks all good now, so let's try
again.
PiperOrigin-RevId: 154544164
-rwxr-xr-x | scripts/ci/build.sh | 6 | ||||
-rwxr-xr-x | scripts/ci/windows/compile_windows.sh | 10 | ||||
-rw-r--r-- | scripts/packages/BUILD | 44 | ||||
-rw-r--r-- | scripts/packages/debian/BUILD | 6 | ||||
-rw-r--r-- | scripts/packages/fedora/BUILD | 4 | ||||
-rw-r--r-- | scripts/packages/self_extract_binary.bzl | 25 |
6 files changed, 61 insertions, 34 deletions
diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh index 08c7389470..6599e72b80 100755 --- a/scripts/ci/build.sh +++ b/scripts/ci/build.sh @@ -142,7 +142,11 @@ function bazel_build() { # Copy the results to the output directory mkdir -p $1/packages cp bazel-bin/src/bazel $1/bazel - cp bazel-bin/scripts/packages/install.sh $1/bazel-${release_label}-installer.sh + # The version with a bundled JDK may not exist on all platforms. + if [ "${JAVA_VERSION}" = "1.8" -a -e "bazel-bin/scripts/packages/with-jdk/install.sh" ]; then + cp bazel-bin/scripts/packages/with-jdk/install.sh $1/bazel-${release_label}-installer.sh + fi + cp bazel-bin/scripts/packages/without-jdk/install.sh $1/bazel-${release_label}-without-jdk-installer.sh if [ "$PLATFORM" = "linux" ]; then cp bazel-bin/scripts/packages/debian/bazel-debian.deb $1/bazel_${release_label}.deb cp -f bazel-genfiles/scripts/packages/debian/bazel.dsc $1/bazel.dsc diff --git a/scripts/ci/windows/compile_windows.sh b/scripts/ci/windows/compile_windows.sh index 802edaeeaa..4168f551b5 100755 --- a/scripts/ci/windows/compile_windows.sh +++ b/scripts/ci/windows/compile_windows.sh @@ -48,11 +48,13 @@ fi ${BOOTSTRAP_BAZEL} --bazelrc=${BAZELRC:-/dev/null} --nomaster_bazelrc build \ --embed_label=${release_label} --stamp \ ${MSVC_OPTS} \ - //src:bazel + //src:bazel //src:bazel_with_jdk - -# Copy the resulting artifact. +# Copy the resulting artifacts. mkdir -p output/ci -cp bazel-bin/src/bazel output/ci/bazel${MSVC_LABEL}-$(get_full_release_name).exe +cp bazel-bin/src/bazel output/ci/bazel${MSVC_LABEL}-$(get_full_release_name)-without-jdk.exe +cp bazel-bin/src/bazel_with_jdk output/ci/bazel${MSVC_LABEL}-$(get_full_release_name).exe cp bazel-bin/src/bazel output/bazel.exe +zip -j output/ci/bazel${MSVC_LABEL}-$(get_full_release_name)-without-jdk.zip output/bazel.exe +cp -f bazel-bin/src/bazel_with_jdk output/bazel.exe zip -j output/ci/bazel${MSVC_LABEL}-$(get_full_release_name).zip output/bazel.exe diff --git a/scripts/packages/BUILD b/scripts/packages/BUILD index 1ebe901a77..a5318b99b4 100644 --- a/scripts/packages/BUILD +++ b/scripts/packages/BUILD @@ -17,16 +17,20 @@ filegroup( srcs = select({ "//src:windows": [], "//src:windows_msvc": [], + "//src:freebsd": [], "//src:darwin": [ - ":install.sh", + ":with-jdk/install.sh", + ":without-jdk/install.sh", ":generate-package-info", ], "//src:darwin_x86_64": [ - ":install.sh", + ":with-jdk/install.sh", + ":without-jdk/install.sh", ":generate-package-info", ], "//conditions:default": [ - ":install.sh", + ":with-jdk/install.sh", + ":without-jdk/install.sh", ":generate-package-info", "//:bazel-distfile", "//scripts/packages/debian:bazel-debian", @@ -64,29 +68,43 @@ genrule( genrule( name = "rename-bazel-bin", + srcs = ["//src:bazel_with_jdk"], + outs = ["with-jdk/bazel-real"], + cmd = "mkdir -p $$(dirname $@); cp $< $@", +) + +genrule( + name = "rename-bazel-bin-without-jdk", srcs = ["//src:bazel"], - outs = ["bazel-real"], - cmd = "cp $< $@", + outs = ["without-jdk/bazel-real"], + cmd = "mkdir -p $$(dirname $@); cp $< $@", +) + +genrule( + name = "bazel-sh-with-jdk", + srcs = ["bazel.sh"], + outs = ["with-jdk/bazel"], + cmd = "mkdir -p $$(dirname $@); cp $< $@", ) genrule( - name = "rename-bazel-sh", + name = "bazel-sh-without-jdk", srcs = ["bazel.sh"], - outs = ["bazel"], - cmd = "cp $< $@", + outs = ["without-jdk/bazel"], + cmd = "mkdir -p $$(dirname $@); cp $< $@", ) load(":self_extract_binary.bzl", "self_extract_binary") -self_extract_binary( - name = "install.sh", +[self_extract_binary( + name = "%s/install.sh" % kind, flatten_resources = [ - ":bazel-real", - ":bazel", + ":%s/bazel-real" % kind, + ":%s/bazel" % kind, "//scripts:bash_completion", ], launcher = ":launcher_bin.sh", -) +) for kind in ("with-jdk", "without-jdk")] genrule( name = "embedded_label", diff --git a/scripts/packages/debian/BUILD b/scripts/packages/debian/BUILD index bc4119b412..6048692034 100644 --- a/scripts/packages/debian/BUILD +++ b/scripts/packages/debian/BUILD @@ -9,12 +9,12 @@ load("//tools/build_defs/pkg:pkg.bzl", "pkg_tar", "pkg_deb") pkg_tar( name = "bazel-bin", files = [ - "//scripts/packages:bazel", - "//scripts/packages:bazel-real", + "//scripts/packages:without-jdk/bazel", + "//scripts/packages:without-jdk/bazel-real", ], mode = "0755", package_dir = "/usr/bin", - strip_prefix = "/scripts/packages", + strip_prefix = "/scripts/packages/without-jdk", ) pkg_tar( diff --git a/scripts/packages/fedora/BUILD b/scripts/packages/fedora/BUILD index 2ee91d01ab..2124f3af43 100644 --- a/scripts/packages/fedora/BUILD +++ b/scripts/packages/fedora/BUILD @@ -13,9 +13,9 @@ pkg_rpm( changelog = "//:changelog-file", data = [ "//scripts:bash_completion", - "//scripts/packages:bazel", "//scripts/packages:bazel.bazelrc", - "//scripts/packages:bazel-real", + "//scripts/packages:without-jdk/bazel", + "//scripts/packages:without-jdk/bazel-real", ], spec_file = "bazel.spec", version_file = "//scripts/packages:version.txt", diff --git a/scripts/packages/self_extract_binary.bzl b/scripts/packages/self_extract_binary.bzl index 425a203b36..75f19279c3 100644 --- a/scripts/packages/self_extract_binary.bzl +++ b/scripts/packages/self_extract_binary.bzl @@ -75,18 +75,21 @@ def _self_extract_binary(ctx): self_extract_binary = rule( _self_extract_binary, - executable = True, attrs = { "launcher": attr.label( - mandatory=True, - allow_files=True, - single_file=True), - "empty_files": attr.string_list(default=[]), + mandatory = True, + allow_files = True, + single_file = True, + ), + "empty_files": attr.string_list(default = []), "resources": attr.label_list( - default=[], - allow_files=True), + default = [], + allow_files = True, + ), "flatten_resources": attr.label_list( - default=[], - allow_files=True), - }, - ) + default = [], + allow_files = True, + ), + }, + executable = True, +) |