feat: under -c opt, automatically compress #89
<img src="https://static.aspect.build/marvin/assets/18px/success-outline.png" align="top"> <a href="https://app.oss.aspect.build/f3c4acff-fee8-40a2-8c9c-61e51c641b8a" target="_blank">Test (Bazel 7.x) (Test)</a>
All tests were cache hits
<i>24 tests (100.0%) were fully cached saving 2s.</i>
---
<img src="https://static.aspect.build/marvin/assets/18px/success-outline.png" align="top"> <a href="https://app.oss.aspect.build/10dd0cf2-4adf-4e0f-a41a-951944aeda0e" target="_blank">Test (Bazel 8.x) (Test)</a>
All tests were cache hits
<i>24 tests (100.0%) were fully cached saving 2s.</i>
---
<img src="https://static.aspect.build/marvin/assets/18px/success-outline.png" align="top"> <a href="https://app.oss.aspect.build/82056388-2021-450a-9a83-9a3313e57269" target="_blank">Test (Bazel 9.x) (Test)</a>
All tests were cache hits
<i>24 tests (100.0%) were fully cached saving 2s.</i>
---
<img src="https://static.aspect.build/marvin/assets/18px/success-outline.png" align="top"> <a href="https://app.oss.aspect.build/975c7952-36a6-4641-abb1-f825b6457d48" target="_blank">Test (Bazel 7.x) (Test)</a>
<h6>e2e/smoke</h6>
All tests were cache hits
<i>1 test (100.0%) was fully cached saving 32ms.</i>
---
<img src="https://static.aspect.build/marvin/assets/18px/success-outline.png" align="top"> <a href="https://app.oss.aspect.build/de39bbd4-a87d-44b8-9c9c-4c4cc734e3df" target="_blank">Test (Bazel 8.x) (Test)</a>
<h6>e2e/smoke</h6>
All tests were cache hits
<i>1 test (100.0%) was fully cached saving 63ms.</i>
---
<img src="https://static.aspect.build/marvin/assets/18px/success-outline.png" align="top"> <a href="https://app.oss.aspect.build/834d4861-18a8-4f0a-a38b-b37f85ae460a" target="_blank">Test (Bazel 9.x) (Test)</a>
<h6>e2e/smoke</h6>
All tests were cache hits
<i>1 test (100.0%) was fully cached saving 45ms.</i>
---
<img src="https://static.aspect.build/marvin/assets/18px/success-outline.png" align="top"> <a href="https://app.oss.aspect.build/e556dc29-74b9-4fc0-9834-dfdf4a39243a" target="_blank">Test (WORKSPACE) (Test)</a>
<h6>e2e/smoke</h6>
All tests were cache hits
<i>1 test (100.0%) was fully cached saving 59ms.</i>
---
<img src="https://static.aspect.build/marvin/assets/18px/success-outline.png" align="top"> <a href="https://app.oss.aspect.build/386c20c9-e9bc-4228-a741-0745388ca6ca" target="_blank">Test (Bazel 7.x) (Test)</a>
<h6>examples</h6>
All tests were cache hits
<i>3 tests (100.0%) were fully cached saving 135ms.</i>
---
<img src="https://static.aspect.build/marvin/assets/18px/success-outline.png" align="top"> <a href="https://app.oss.aspect.build/053264f9-10fa-4307-8dc2-deaad26d0f6c" target="_blank">Test (Bazel 8.x) (Test)</a>
<h6>examples</h6>
All tests were cache hits
<i>3 tests (100.0%) were fully cached saving 158ms.</i>
<!--H4sIAAAAAAACA+2YTYscRwyG/4rpXGIY7daHqkqaWxJyyiEhCeRgwiBVlexh52OZ7sF2lv3voT1r8uGNgzcYZsneGqmokt56WrzdN8P09roPy+HQx+NmGhZD3e+m/mYaloNeLZ3nUix4YE4BEDkClxKBMjofTFibLi9kvO51uny9P1zZZv96vKz7na1fXryV7WZYDHpcb9qwvDk9rHbHrfbDsAwO73Kr42EzLIdX03Q9Li8v38Wu1lO/qPvt5WlzeBe8nOQAbT+B/rY5LRsvg8O56vXq1X48VT3cLu7aGYfli5thkvFqtW5zTn7rGyjD4hTbyXZu/ec+Ts++/HrOPSsXb54/+3KOPH+/6j8W94XzLD23DNKKA9RSgTgTZN89No7enL5XaXWqe3Vc/+1Yub6+2I/jndQXpwO5pFrmi4lZMmBGD6LqwSgkzZhKQxoWw3wv47XUudce+uW43V/1YTGMk0zHcVgO47HW3ltvw2Loh8P+MF/WOw52s6KzEIfjrsrU27B0t3e63IEz9XHGxmS9We9erk5tSJ3W+924mvaTbIal+4f8sHzx6zvibP3yeJC72M3QQiZUVtLaUg/BJcxKai5T8eq05oRmPWpwLsZosXSJzhtbyo2J5j22u77d79Z1WA5XBCbjdOLwdjFY86ROU/bYY3Cq1rlJR0voXSaVnj0JqzhsXLQ5VxljxaqEIcT40e1nefo43fV2LePY22qO/FmMjVy9/SAo682HS6vUV3+L+tMJq2m97atTfljGcLs4J9RzBkRKQGYdCjWzJClTaA9D3WJFqWZgvROgkwBUuc4vUfI1o1eSJ6QfLdIB72Pak+f7qKaPUE2fl+oKyK6DVvMgPnjq3luj/DCqvWvNVQuA0gywOwNBL8DJM6L0Ju68B7XLRTxhD5LUJcHEmHxLrguGGFCNmELpFDFFjsRFVLnVQslX9lT/hWpXnONunjPG0kurwRVii5izI52Vk4rmLXYOpXJvXtQKByotZef9mVLN+T6q+SNU8+elugEqBphnD9SWrSYvIVF6GNUUXMqRCIILHjA5ARaKwBKjjz2VkPmsqS6+ELPP6KPFqqZcvHX0yXFCx1R6j7UqZmFSwo7FxHvNoahFRvu3Wd2LmlAvSWNlVzIVTalUKz1Vkigx9eZTC5mxVNVeOHFQ815d4uDOk+rk8a9U/2E77+P6l+9//O6nH7765tvPxLWAM2uAZAWYyEHl2HPK6j35h3HdU8qtBoaCyoBWHTBFhGbNUCIHjPJkt/8fdjudmTEpAdAbgaoF8Fp8ibl2rg80Jq1HVm0IQqUBohLwbLexYq0lYo/NHiXqT4blk1HP8bzcSomAUiJIswxFtFI0H9XsgW4lYkPKHjwJAZoTkEgKGotRko7ZPc6p/uRiPhl1TOf1E6UkQCME1uahZkOu2qhGehjqkXINrjJ01goYAoEU9OAKpkhUJdcPUH8j2+tNH5/8y6P1L/Feux7TmRmYDCi1gQYk8NoDph4xpAd+g7oUQ0Zj8M4EMLoC1GqA1kVayM1Zro8R9Sf/8umoJ7r99fZ3AG6DAekaAAA=-->
<sub><sub>!P1 Badge</sub></sub> Compress default references missing config_setting
The tar macro now hardcodes compress = kwargs.pop("compress", select({Label(":compilation_mode.opt"): "gzip", "//conditions:default": None})). Label(":compilation_mode.opt") is resolved relative to the caller’s package, but the only compilation_mode.opt config_setting lives in //tar:compilation_mode.opt. Any consumer that invokes tar(...) outside //tar without explicitly setting compress will get a load-time error for a missing target :<compilation_mode.opt> (or a type error if it resolves to None). This breaks the default macro usage in downstream packages; the select should point at the repository’s config_setting (e.g. //tar:compilation_mode.opt).
Useful? React with 👍 / 👎.
💡 Codex Review
Here are some automated review suggestions for this pull request.
<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
</details>
The Label() constructor avoids the string being evaluated in the caller's context
Also not too sure about this. What if a user does not want to have compression despite an opt build.
One scenario that comes to my mind are simulations. Let's say the simulation pipeline produces oci images which are then executed. You want the best performance for your binaries, since simulation is still some sort of internal testing, you might not care about storage as much as time. And having no compression saves some time.
If you want to save time, you'd never run an opt build because all other compile steps would also be slower, right? Compressing a tar file feels very much the same use case as spending more time making any other build output smaller or run faster?
Right, but when running simulations you might want your pipeline to be fast but at the same time have the binaries running in the simulation to be optimized.
I think that's a fine use-case, but calls for finer grained settings defined by then user than -c opt which is a blanket optimize everything indicator. As a matter of default behavior, I think this is reasonable and improves the majority fastbuild case.
Approved these changes.
Approved these changes.
A change to compression level by default would be _okay_ I think, but .tar -> .tar.gz is too great a change.
arrdem
alexeagle
Not sure it's a good idea though, since the output filename changes to .gz