- Feb 12, 2025
-
-
Bot authored
## [1.0.1](https://git.gitlab.arm.com/bazel/ape/compare/v1.0.0...v1.0.1) (2025-02-12) ### Bug Fixes * bump to `toolchain_utils@1.0.2` for Bash 3.2 support ([90747dd9](https://git.gitlab.arm.com/bazel/ape/commit/90747dd993141fa5300498a0b993b662087edaf6)) * correct MacOS Apple Silicon launcher name ([45d9c1fe](https://git.gitlab.arm.com/bazel/ape/commit/45d9c1fe2ff27b380a1a2cff5b53deac966cde91)) * upgrade to `download_utils@1.0.1` ([9957f028](https://git.gitlab.arm.com/bazel/ape/commit/9957f0283242d332c8b80d3d5ae9693648a33d1e)) * use `ssize_t` for `readlink` return value ([dd4f2afa](https://git.gitlab.arm.com/bazel/ape/commit/dd4f2afaf8de0530a563b584b4abe2b2803c10b7)) * use `zig` target to build APE launcher ([d247cc5a](https://git.gitlab.arm.com/bazel/ape/commit/d247cc5af020d6fc32885c6680e2a32f372cb557)) * use indirect symlink on Apple Silicon ([c53415d6](https://git.gitlab.arm.com/bazel/ape/commit/c53415d60c45e7dc3ee732817d1abacbb297b0da)), closes [/github.com/jart/cosmopolitan/blob/9f6bf6ea71e1385cc34dab0c492773f428d62869/ape/ape-m1.c#L1043-L1055](https://git.gitlab.arm.com//github.com/jart/cosmopolitan/blob/9f6bf6ea71e1385cc34dab0c492773f428d62869/ape/ape-m1.c/issues/L1043-L1055) * walk symlinks on Apple Silicon ([e626a39d](https://git.gitlab.arm.com/bazel/ape/commit/e626a39d8b87954e390919b71ce98e072d3742a2)) * watch `zig`/`srcs` in `compile` repository rule ([48aa2786](https://git.gitlab.arm.com/bazel/ape/commit/48aa278682b56045e6bfa3ddcbbd1fde3ec33ea0))
-
Matthew Clarkson authored
-
-
-
-
-
-
-
-
-
-
Matthew Clarkson authored
-
Matthew Clarkson authored
Ensures we get `toolchain_utils@1.0.2` across the graph. We are not intending to upstream `toolchain_utils@1.0.1`.
-
Matthew Clarkson authored
We are now using a feature of the APE launcher to use indirect symlinks. This allows the APE launcher to be symlinked with an `.ape` extension. The APE launcher will remove the `.ape` extension and then launch the binary at that path. This works really well under Bazel because it can handle creating the indirect and direct symlink for a APE binary. For example: ``` $ ls -l ape-arm64.macho awk $ ape-arm64.macho awk --version awk version 20240311 $ ln -s ape-arm64.macho awk.ape $ ./awk.ape # APE launcher removes the `.ape` and executes the `awk` APE binary awk version 20240311 ``` However, Bazel requires that a rule _must_ return files that it has declared and created. A common pattern is to simply symlink to a previously generated file and return that through the `DefaultInfo`. This breaks the indirect symlink because the downstream symlink can remove the `.ape` extension. Even if the symlink includes the `.ape` extension, unless it also generates a direct symlink for the APE launcher to find, it will fail to launch. This patches the APE launcher to walk symlink chains back to the final symlink. It adds a new function to the APE launcher binary: `WalkToIndirect`. The function uses two buffers to walk the symlinks until it finds a path that is not a symlink. The previous path _must_ be the indirect symlink. It needs to use an additional buffer to read the linkname. It will return zero if the new path can be stored in the provided buffer. If not, it will return the number of bytes to allocate. We use this functionality to store the path in the same character buffer used by the system provided environment. If there is not enough space, we then allocate on the stack and store it there. An alternative option is to build a launcher binary that uses runfiles to find both the APE launcher and binary. The preference was to avoid this to be resilient against subprocess calls that do not forward on runfiles information. It would also require a programming language that is hermetic, which would likely be `rules_go`. This is a heavy dependency for users just wanting to launch APE binaries on Apple Silicon. We are _already_ requiring the download of a hermetic C toolchain on Apple Silicon so it makes sense to reuse this download to provide the functionality needed for hermetic launching on Apple Silicon. This is an inperfect solution: all other platforms assimilate a single binary that can be launched on the system. Unfortunately, due to the limitations of the APE format on Apple Silicon, the APE launcher always needs to be in the loop as native binaries are assimilated to ELF. The downstream user now needs to be aware that on Apple Silicon, there are runfiles that need to be forwarded which limits the simple message that an `ape_assimilate` generates a native binary that can be launched. If APE learns how to generate launchable binaries on Apple Silicon, we can switch to `_direct` from `_indirect` and drop the `ape-m1.patch`.
-
Matthew Clarkson authored
Makes the execution of the symlink entirely hermetic. Previously, a direct symlink was used which required the APE binary to unpack and compile the embedded APE launcher. This requires a `cc` on the system. This patch shifts to use the already compiled APE launcher and a "indirect" symlink. The [indirect] symlink feature works by having a `.ape` extension to a symlink that points at the APE launcher. The launcher then removes the `.ape` extension and uses that as the path to the binary to launch. The crucial point is that assimilating an APE binary on MacOS is not natively launchable, unlike all other platforms: ```console $ cd /tmp $ curl -sfSL https://cosmo.zip/pub/cosmos/v/4.0.2/bin/assimilate > assimilate $ curl -sfSL https://cosmo.zip/pub/cosmos/v/4.0.2/bin/awk > awk $ chmod +x assimilate $ chmod +x awk $ ./ape # Already compiled from the patched `ape-m1.c` usage: ape PROG [ARGV1,ARGV2,...] ape - PROG [ARGV0,ARGV1,...] PROG.ape [ARGV1,ARGV2,...] actually portable executable loader silicon 1.10 copyrights 2023 justine alexandra roberts tunney https://justine.lol/ape.html $ ./ape ./awk awk version 20240311 $ ./awk xcode-select: note: No developer tools were found, requesting install. If developer tools are located at a non-default location on disk, use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, and cancel the installation dialog. See `man xcode-select` for more details. $ ./ape ./assimilate -o awk.assimilated awk awk: ape macho dd command for arm64 not found; by convention ape executables are run on apple silicon only as elf binaries, which are loaded by the ape-m1.c ape loader program; thus consider passing the -ae flags to assimilate to arm64 elf (the host os uses macho natively) $ ./ape ./assimilate -ae -o awk.assimilated awk $ chmod +x awk.assimilated $ ./awk.assimilated zsh: exec format error: ./awk.assimilated $ ./ape ./awk.assimilated awk version 20240311 $ ln -s ape awk.ape # indirect symlink $ ./awk.ape awk version 20240311 $ ln -s awk.ape abc # symlink chain (does not work without the patch) awk version 20240311 ``` [indirect]: https://github.com/jart/cosmopolitan/blob/9f6bf6ea71e1385cc34dab0c492773f428d62869/ape/ape-m1.c#L1043-L1055
-
- Feb 11, 2025
-
-
Matthew Clarkson authored
As per the runfiles specification, runfile environment variables should be passed down to subprocesses.
-
Matthew Clarkson authored
Removes the need to have the MacOS SDK installed
-
Matthew Clarkson authored
Keeps the consistency and explicitness for `MODULE.bazel`
-
Matthew Clarkson authored
Helps make `MODULE.bazel` more consistent and explicit
-
Matthew Clarkson authored
-
Matthew Clarkson authored
Bazel does not invalidate downstream repository rules unless explicitly watched.
-
- Feb 06, 2025
-
-
Matthew Clarkson authored
-
Matthew Clarkson authored
-
- Feb 05, 2025
-
-
Matthew Clarkson authored
-
Matthew Clarkson authored
Missed the `inputs` key, oops.
-
Bot authored
# 1.0.0 (2025-02-05) ### Bug Fixes * alias assimilate targets ([1632a5fd](https://git.gitlab.arm.com/bazel/ape/commit/1632a5fd837b2d8a0c1b73a6f5606e9a4ede0f72)) * **ape_assimilate:** add `ppc64` support ([b3ace36d](https://git.gitlab.arm.com/bazel/ape/commit/b3ace36d27a3f9a3f934de7b145a57afb25a9978)) * **ape_toolchain:** make `toolchain_utils` constraints relative to `[@ape](https://git.gitlab.arm.com/ape)` module ([69001a59](https://git.gitlab.arm.com/bazel/ape/commit/69001a59b44c7618fc04f51ae741a884710daa60)) * **ape.pe:** implement a C# launcher ([4f667dd8](https://git.gitlab.arm.com/bazel/ape/commit/4f667dd858d683e43176d538797931f52b39f036)) * **assimilate:** ensure Windows executable extension ([4e636524](https://git.gitlab.arm.com/bazel/ape/commit/4e636524a5cfa246a24d8478d2c2f2494fee0983)) * **assimilate:** make rule public ([d4b1be09](https://git.gitlab.arm.com/bazel/ape/commit/d4b1be09d711defd822cb581c43674924e04e656)) * **assimilate:** propagate runfiles ([afcd2473](https://git.gitlab.arm.com/bazel/ape/commit/afcd247373004a05c4ede739a571cb9ef6b82d64)) * **assimilate:** symlink on Apple Silicon ([d3a05909](https://git.gitlab.arm.com/bazel/ape/commit/d3a0590934a3c560d3456942a202caeda4158e08)) * **assimilate:** symlink on Windows ([21c70a35](https://git.gitlab.arm.com/bazel/ape/commit/21c70a35358847fb6452f1b086d5ae208b0f9b33)) * **assimilate:** use ELF on Apple Silicon ([85084d32](https://git.gitlab.arm.com/bazel/ape/commit/85084d326695d94c033e9458ebad84cabb83455d)) * **binary:** correct visibility of binary template ([3f33ed44](https://git.gitlab.arm.com/bazel/ape/commit/3f33ed44a93cc4c5405416b366752c817ba45da9)) * **binary:** find external runfiles on Windows ([a6a8df04](https://git.gitlab.arm.com/bazel/ape/commit/a6a8df04ed1181c30c01d68e6ef1b9e5512c1374)) * **binary:** make rule public ([793c0f2e](https://git.gitlab.arm.com/bazel/ape/commit/793c0f2e83b3f95ce7b147d6fc65c2a9c3c07d79)) * bump minimum version to Bazel `7.4.0` ([bf86a08c](https://git.gitlab.arm.com/bazel/ape/commit/bf86a08cc9775c710e5be3dff31b566976826ba5)) * correct `ape-m1.c` upstream URL ([db0cb832](https://git.gitlab.arm.com/bazel/ape/commit/db0cb83293d1ef9df91882e71dfba8007dd2a7ad)) * correct PE launcher target ([3af329c6](https://git.gitlab.arm.com/bazel/ape/commit/3af329c66df8c38e7cfce3478dc61862be49d684)) * **entrypoint:** add `local = True` ([699fcb6c](https://git.gitlab.arm.com/bazel/ape/commit/699fcb6c036b94a3505d4231ee522daafbb4391d)) * **entrypoint:** assimilate on Linux ([b4ff17be](https://git.gitlab.arm.com/bazel/ape/commit/b4ff17be88820667fd85fb37283e0e5d06130087)) * **entrypoint:** remove toolchain target ([d9d60dc2](https://git.gitlab.arm.com/bazel/ape/commit/d9d60dc262dafe669e661bc48f339f77322f4a6c)) * make `@ape//:*` binaries remote execution friendly ([7ae62935](https://git.gitlab.arm.com/bazel/ape/commit/7ae62935125b5e72ccaab248bc3a73b927901403)) * make `@ape//:*` targets private ([1f9ebb25](https://git.gitlab.arm.com/bazel/ape/commit/1f9ebb2549b67f08542e9f2b5f59349a8d000fae)) * mirror binaries ([b6b4b780](https://git.gitlab.arm.com/bazel/ape/commit/b6b4b780e211707ed14d9d466571ba7bd3fab0a7)) * register toolchains for supported platforms ([37883016](https://git.gitlab.arm.com/bazel/ape/commit/3788301606765c37ad6f22ebb01d86168319d355)) * rolled back `pigz` version ([6d098c8a](https://git.gitlab.arm.com/bazel/ape/commit/6d098c8a6b80b86eda05c25996927e207c9878d8)) * support for MinGW shell ([76a064cb](https://git.gitlab.arm.com/bazel/ape/commit/76a064cb9299d6b66d6874d786f59509e78ee1ea)) * switch `toolchain_local_select#map` to lazily fetch labels ([292d222b](https://git.gitlab.arm.com/bazel/ape/commit/292d222b42ea54837ff049b9bce1146a96197515)) * switch to `rules_license` for licensing ([75da473a](https://git.gitlab.arm.com/bazel/ape/commit/75da473a1f4d17f889978e487cd3ed285879d499)) * upgrade `toolchain_utils@1.0.0-beta.17` for Bazel 8+ support ([798f0612](https://git.gitlab.arm.com/bazel/ape/commit/798f06125affc958172882443f827c4a9194311b)) * upgrade binaries to `cosmo.zip@3.9.2` ([000b7686](https://git.gitlab.arm.com/bazel/ape/commit/000b76867773dad719517cca226ba165f6606cce)) * upgrade to `toolchain_utils@1.0.0-beta.9` ([246b23be](https://git.gitlab.arm.com/bazel/ape/commit/246b23be38f24f24b360a4649a1f55706f5b651f)) * upgrade to stable versions of `{download,toolchain}_utils` ([eec84e32](https://git.gitlab.arm.com/bazel/ape/commit/eec84e32afd527e7deb79703ae3c7d027937bbba)) * **upload:** bump to `rules_curl@1.0.0-alpha.8` ([46be5506](https://git.gitlab.arm.com/bazel/ape/commit/46be5506f8c2fe37a4d2bc649f1abb47c9f875fb)) ### Code Refactoring * add `cosmos` downloader ([876c6c7a](https://git.gitlab.arm.com/bazel/ape/commit/876c6c7a1c04e7d3e19062f0031e3b2b3099c9e5)) * **binary:** change from `target` to `src` ([ce0fb14f](https://git.gitlab.arm.com/bazel/ape/commit/ce0fb14f408a2a5bd3afb5c2a3b0b8673bd7aed0)) * remove `@ape//:*` targets ([240f34d4](https://git.gitlab.arm.com/bazel/ape/commit/240f34d4414e324e40a90cb6e928dd41041421e9)) ### Features * add `@ape//ape/toolchain/info:*` targets ([c767ec08](https://git.gitlab.arm.com/bazel/ape/commit/c767ec08894e1874cd183ffe99e76c4f25e1bc86)) * add `//:assimilate` ([4a43c390](https://git.gitlab.arm.com/bazel/ape/commit/4a43c3907740218bebcda4c6c5c6f1bc26c63c32)) * add `//ape/toolchain/ape:type` ([3e73cdb6](https://git.gitlab.arm.com/bazel/ape/commit/3e73cdb63c21caede525321dc8f797ec9fcc1945)) * add `ape_assimilate` rule ([0ffc0247](https://git.gitlab.arm.com/bazel/ape/commit/0ffc02472fac8cd93db0daa393fab072c5864e68)) * add `ape_binary` rule ([6577cd36](https://git.gitlab.arm.com/bazel/ape/commit/6577cd36eeaf814b38a66a3c1fbd1e7ce218f1e6)) * add `ape_toolchain` macro ([e89d679e](https://git.gitlab.arm.com/bazel/ape/commit/e89d679e18822f90ac64f14479932b0477ee8239)) * add `chmod`/`cp`/`dd`/`echo`/`gzip`/`mkdir`/`mv`/`printf`/`rm`/`uname` ([b312d301](https://git.gitlab.arm.com/bazel/ape/commit/b312d30110dda67426e6db2e124a1c316340ec2b)) * add `diff`, `diff3`, `sdiff`, `cmp` and `patch` ([a49565d5](https://git.gitlab.arm.com/bazel/ape/commit/a49565d57425470e12d74a42e1f481bb70543ded)) * add `exec_compatible_with` to `ape_toolchain` ([fee2332c](https://git.gitlab.arm.com/bazel/ape/commit/fee2332c067c7ee065fc14f15de86408fe8cd56a)) * added semantic release to bazel template ([a8a66341](https://git.gitlab.arm.com/bazel/ape/commit/a8a663411461dfd66fcc36635b1659a1beb3bd6b)) * **entrypoint:** add `binary` alias back to the original downloaded APE binary ([2a3b317f](https://git.gitlab.arm.com/bazel/ape/commit/2a3b317f3926965c9eaaa48b1c8d4d387b271163)) * expose `cosmo@v3.2.4` binaries ([c8dd4cbc](https://git.gitlab.arm.com/bazel/ape/commit/c8dd4cbc64cd6c213b5f4bf73279b7b265d06f8c)) * make `@ape//ape:*` targets publically visible ([4978c177](https://git.gitlab.arm.com/bazel/ape/commit/4978c177fd073b18eec3e600a5a2fe1e26f5b5f8)) * support Apple silicon ([8725298c](https://git.gitlab.arm.com/bazel/ape/commit/8725298cf9dddb7fbc40c466a7fcb403eb8dd7a5)) * switch to assimilated binaries ([def09160](https://git.gitlab.arm.com/bazel/ape/commit/def09160eeaeba44a59717b23a04ac626584e2b9)) * upgrade binaries to `cosmo.zip@4.0.2` ([9da564c4](https://git.gitlab.arm.com/bazel/ape/commit/9da564c449ae2641c4a8145051ac5f80f6ac3734)) * upgrade to `3.7.1` binaries ([ac2753e1](https://git.gitlab.arm.com/bazel/ape/commit/ac2753e15fbef915ee3ecdd220efe76201e4e2fd)) * upgrade to `cosmos@3.3.1` ([eb9f860f](https://git.gitlab.arm.com/bazel/ape/commit/eb9f860f207ae8ccdea93ce637b0e5305a99fb14)) ### BREAKING CHANGES * A new `ape_cosmos` extension has been implemented that allows flexible downloading of `cosmos.zip` binaries. Repositories can now be imported directly from that extension rather than `@toolchain_utils//toolchain/export:def.bzl#toolchain_export`. Previously a repository would be imported as so: ```py export = use_extension("@toolchain_utils//toolchain/export:defs.bzl", "toolchain_export") use_repo(export, "ape-zstd") ``` Now the extension has all the available repositories: ```py cosmos = use_extension("@ape//ape/cosmos:defs.bzl", "ape_cosmos") use_repo(cosmos, "zstd") ``` * The `@ape//:*` aliases have been removed in favour of the more explicit `@ape//ape/toolchain/info:*` targets. * `ape_binary` rule has been removed. It was plagued with runfile issues that are practically unsolvable in a hermetic way. The `ape_assimilate` rule is far superior and has been the default for the `@ape//ape:*` aliases for many releases. Finally removing the rule in lead up to `1.0.0` release. * `@ape//:*` targets have been removed. The aliases pointed at `@ape//ape/toolchain/info:*` targets which is a more descriptive target. Use those. * **binary:** The `ape_binary#target` attribute has changed to `ape_binary#src`. This aligns to other `*_binary` rules such as `sh_binary`. * **entrypoint:** The `toolchain_symlink_target` has been removed from `ape_entrypoint`. This symlink target used the repository context entrypoint which is not remote execution friendly. The targets were aliased as `@ape//:*` which have been corrected to be remove execution friendly. Use those targets instead.
-
Matthew Clarkson authored
-
Matthew Clarkson authored
-
Matthew Clarkson authored
-
Matthew Clarkson authored
-
Matthew Clarkson authored
-
Matthew Clarkson authored
-
Matthew Clarkson authored
-
Matthew Clarkson authored
-
Matthew Clarkson authored
-
Matthew Clarkson authored
-
In the `bazelisk` CI image, the SSL certificates are not correctly picked up. There needs to be an upstream fix. ci/component/bazelisk#13
-
-
-
-