Create Windows ZIP release artifact using Bazel
The new pipeline does not support ziping artifact which was
a custom hack for Windows, relies on Bazel to generate those
zip instead.
Step forward fixing bazelbuild/continuous-integration#101
To cherry-pick for #3375.
Change-Id: Id566d66bb179096d60c5b535f245d64cea28c5b8
PiperOrigin-RevId: 163054883
diff --git a/scripts/packages/BUILD b/scripts/packages/BUILD
index a5318b9..1c6cf4a 100644
--- a/scripts/packages/BUILD
+++ b/scripts/packages/BUILD
@@ -15,7 +15,10 @@
filegroup(
name = "packages",
srcs = select({
- "//src:windows": [],
+ "//src:windows": [
+ ":zip-bazel-exe",
+ ":zip-bazel-exe_with_jdk",
+ ],
"//src:windows_msvc": [],
"//src:freebsd": [],
"//src:darwin": [
@@ -52,6 +55,22 @@
tools = [":package-info-generator"],
)
+[genrule(
+ name = "zip-bazel-exe" + suffix,
+ srcs = ["//src:bazel%s.exe" % suffix],
+ outs = ["bazel%s.zip" % suffix],
+ cmd = "\n".join([
+ "tmpdir=$$(mktemp -d $${TMPDIR:-/tmp}/tmp.XXXXXXXX)",
+ "trap \"rm -fr $${tmpdir}\" EXIT",
+ "mv $(SRCS) $${tmpdir}/bazel.exe",
+ "touch -t 198001010000.00 $${tmpdir}/bazel.exe",
+ "zip -jq $@ $${tmpdir}/bazel.exe",
+ ]),
+) for suffix in [
+ "",
+ "_with_jdk",
+]]
+
genrule(
name = "generate-launcher",
srcs = [