Commit graph

10 commits

Author SHA1 Message Date
Jeff Gaston
c5eb66d16b Have soong_zip not write a data descriptor for non-compressed files
Bug: 64536066
Test:  m -j blueprint_tools && cd /tmp && mkdir zip && \
       cd zip && touch empty-file && \
       echo empty-file > files.list && \
       soong_zip -o zip.zip -C . -l files.list && \
       jar -xvf zip.zip && echo ok

Change-Id: Iac5797aab5282237fa1cc902e6b068a7937c012a
2017-08-24 14:43:35 -07:00
Jeff Gaston
175f34c5c3 Revert "Revert "Refactor rate_limit.go for more clarify""
This reverts commit 526416b1e4.

Figured out a fix for the deadlocks; resubmitting the patch.
The first version was deadlocking because the switch statement in
zipWriter.write would choose a specific zip entry to start writing,
but the individual chunks may not have all necessarily been compressed
yet. When each individual chunk was made to require to request its own
allocations, the compression of the chunks of the file being currently
written could be blocked waiting for memory to be freed by chunks from
other files that hadn't yet started being written.

This patch is much like the original except it preallocates the memory
for the entire file upfront (and happens to use the total file size
rather than the compressed size, but I didn't observe that to cause any
performance differences).

Bug: 64536066
Test: m -j dist showcommands # which runs soong_zip to package everything

Change-Id: Id1d7ff415e54d3a6be71188abbdbbbab5a719fcf
2017-08-17 21:46:46 -07:00
Colin Cross
526416b1e4 Revert "Refactor rate_limit.go for more clarify"
This reverts commit 69f3b3e946.

Caused rare deadlocks.

Bug: 64536066
Bug: 64813447
Change-Id: Ieb1b931bb2c0afdd8bf8edbfc32c373df3c08d8d
2017-08-17 23:54:51 +00:00
Jeff Gaston
69f3b3e946 Refactor rate_limit.go for more clarify
This wasn't intended to change the behavior, but it does slightly.

  Previously any requests to acquire memory wouldn't block; only
  (subsequent) requests for execution would block (if another
  caller had already consumed the memory quota). Now the requests
  for memory can also also block.

It turns out in a brief test on my computer that soong_zip
runs about 10 to 20% faster with this change than without it.

  The final step involving soong_zip decreased from about
  3.6 sec to about 3.3 sec in tests on my computer.

  When testing the process of re-zipping the contents of
  angler-target_files*.zip , the time decreased from about
  6.3 sec to about 5.3 sec in tests on my computer, and the
  peak memory usage reported by `top` decreased from about
  1.5g to 1g

Bug: 64536066
Test: m -j dist showcommands # which runs soong_zip to package everything
Change-Id: I0422e4c363c675bb7a93309fac4616c768bfbe8f
2017-08-16 15:54:25 -07:00
Jeff Gaston
2d174132c4 Have soong_zip add entries for ancestor directories
Bug: 64536066

Test: When I run:

$ mkdir -p a/b/c
$ touch a/b/c/d
$ soong_zip -o test.zip -d -C . -f a/b/c/d
$ zipinfo -1 test.zip
a/b/c/
a/b/c/d

I should get:
a/
a/b/
a/b/c/
a/b/c/d

Change-Id: I779bb48062dfaf88a70fab08d8d98d1e366087b3
2017-08-15 18:57:39 -07:00
Nan Zhang
f281bd8c7b Supported minor features in soong_zip
1. Added ability to keep the mixed "-f"/"-l" order as same as
command-line flags order.

2. Added "-s" flag to specify which target file within zip is stored uncompressed.

Test: manual
Change-Id: I338b25a7bd6bf1b7e9cc29ad3324575167630fb7
2017-05-02 17:28:35 -07:00
Nan Zhang
9067b04ffb Added functionality in soong_zip that supports adding root prefix.
Added -P flag in soong_zip:
It provided a path prefix which will be added in front after -f/-l was
applied with -C.

eg. ./soong_zip -o /path1/../ -P a/c -C d/e -f d/e/test.txt

zip_dest: a/c/test.txt

Bug: b/31676493
Test: go build -a to build a real soong_zip, and test it with real
files.
Change-Id: Ic924ba252e963ca5847c370f733058888426b696
2017-03-20 10:59:49 -07:00
Dan Willemsen
a8b5502773 Refactor compressWholeFile to take a zipEntry
Test: m -j vts; compare android-vts.zip
Test: soong_zip -C ./ -f short_test.sh -f log -o test.zip
Change-Id: I9a843c6f8436ecfacc7948915e50f25c04497057
2017-03-15 21:53:58 -07:00
Dan Willemsen
10462b3fd5 Preserve executable bit in soong_zip
Bug: 36292596
Test: m -j vts; zipinfo out/host/linux-x86/vts/android-vts.zip
Change-Id: If595641544cc387019d93b99e0a7890e0b7a9453
2017-03-15 19:13:30 -07:00
Dan Willemsen
47ec28f3b1 Rename soong_jar to soong_zip
This is a general purpose tool that happens to contain some jar specific
features.

Change-Id: I05f4654d4517c245ad7a3c15492e0d2368bbf64f
2016-08-11 01:30:16 -07:00
Renamed from cmd/soong_jar/soong_jar.go (Browse further)