Skip to content

Commit 1730a59

Browse files
author
Borja Lorente
committed
fix: Rely on the bazel zipper instead of zip
1 parent cc2760e commit 1730a59

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

intellij_platform_sdk/build_defs.bzl

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,26 @@ def no_mockito_extensions(name, jars, **kwargs):
592592
cmd = """
593593
cp "$<" "$@"
594594
chmod u+w "$@"
595-
zip -d "$@" mockito-extensions/*
595+
tmpdir=$$(mktemp -d)
596+
zipper="$$(pwd)/$(execpath @bazel_tools//tools/zip:zipper)"
597+
"$$zipper" x "$@" -d ".out"
598+
mv ".out" "$$tmpdir"
599+
600+
pushd "$$tmpdir/.out" >/dev/null
601+
rm -fr "mockito-extensions"
602+
603+
# We store the results from `find` in a file to deal with filenames with spaces
604+
files_to_tar_file=$$(mktemp)
605+
find . -type f | sed 's:^./::' > "$${files_to_tar_file}"
606+
IFS="\n" read -r -d "" -a files_to_tar < "$${files_to_tar_file}" || true
607+
608+
"$$zipper" cC "../out.jar" "$${files_to_tar[@]}"
609+
popd
610+
611+
cp "$$tmpdir/out.jar" "$@"
612+
chmod u+rw "$@"
596613
""",
614+
tools = ["@bazel_tools//tools/zip:zipper"],
597615
)
598616
output_jars.append(output_jar_name)
599617

0 commit comments

Comments
 (0)