Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zip Java tools for windows #7708

Closed
wants to merge 11 commits into from
Closed

Conversation

iirina
Copy link
Contributor

@iirina iirina commented Mar 13, 2019

Create a zip archive for the remote Java tools for Windows instead of a tar, which can not be parsed on some other platforms.

Bazel doesn't have the equivalent of a pkg_zip rule and this PR introduces two new scripts that use zip directly:
third_party/merge_zip_files.sh: merges all the given zip files into a single zip
third_party/zip_files.sh: archives all the inputs files under the given directory structure in the output zip file

@aiuto aiuto requested a review from laszlocsomor March 13, 2019 18:18
@aiuto aiuto added the area-Windows Windows-specific issues and feature requests label Mar 13, 2019
@iirina iirina requested a review from lberki March 14, 2019 09:16
third_party/BUILD Outdated Show resolved Hide resolved
@iirina iirina requested a review from lberki March 14, 2019 13:57
Copy link
Contributor

@lberki lberki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly shell style nits.

third_party/merge_zip_files.sh Outdated Show resolved Hide resolved
third_party/merge_zip_files.sh Outdated Show resolved Hide resolved
third_party/merge_zip_files.sh Outdated Show resolved Hide resolved
third_party/merge_zip_files.sh Outdated Show resolved Hide resolved
third_party/merge_zip_files.sh Outdated Show resolved Hide resolved
third_party/merge_zip_files.sh Outdated Show resolved Hide resolved
third_party/zip_files.sh Outdated Show resolved Hide resolved
third_party/merge_zip_files.sh Outdated Show resolved Hide resolved
third_party/zip_files.sh Outdated Show resolved Hide resolved
Copy link
Contributor

@laszlocsomor laszlocsomor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I forgot to send my comments yesterday. :(

third_party/zip_files.sh Outdated Show resolved Hide resolved
src/main/cpp/util/BUILD Outdated Show resolved Hide resolved
third_party/merge_zip_files.sh Outdated Show resolved Hide resolved
third_party/java/java_tools/BUILD Outdated Show resolved Hide resolved
tmp_dir=$(mktemp -d -t 'tmpdirXXXXX')
tmp_zip="$tmp_dir/archive.zip"

zip -j -q "$tmp_zip" "$@"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sort input files for determinism; consider using -D


mkdir -p "$tmp_dir/$directory_structure"
cd "$tmp_dir/$directory_structure"
unzip -q "$tmp_zip"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why unzip and zip again?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unzipping everything under the given directory_prefixso that when zipping directory_prefix the zip content has the same directory structure. I couldn't find a way to get the same results only by using zip. If you have any experience with this I'm happy to replace this part of the script.

@iirina iirina requested a review from lberki March 18, 2019 08:38
@iirina
Copy link
Contributor Author

iirina commented Mar 18, 2019

@lberki all comments addressed, ready for re-review

src/merge_zip_files.sh Show resolved Hide resolved
src/merge_zip_files.sh Show resolved Hide resolved
src/merge_zip_files.sh Show resolved Hide resolved
bazel-io pushed a commit that referenced this pull request Mar 18, 2019
Create a zip archive for the remote Java tools for Windows instead of a tar, which can not be parsed on some other platforms.

Bazel doesn't have the equivalent of a `pkg_zip` rule and this PR introduces two new scripts that use `zip` directly:
`third_party/merge_zip_files.sh`: merges all the given `zip` files into a single `zip`
`third_party/zip_files.sh`: archives all the inputs files under the given directory structure in the output `zip` file

Partial merge of #7708.

PiperOrigin-RevId: 238969545
bazel-io pushed a commit that referenced this pull request Mar 19, 2019
Partial commit of third_party/*. See #7708.

Signed-off-by: iirina <[email protected]>
@iirina
Copy link
Contributor Author

iirina commented Mar 19, 2019

All changes merged.

@iirina iirina closed this Mar 19, 2019
@philwo philwo added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Windows Windows-specific issues and feature requests cla: yes team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants