| Build the APK with buck2, from pins rather than from a second checkout a71ef8f nandi 19d ago | 1 | # DotSlash, as a build artifact rather than something found on the machine. |
| 2 | # |
| 3 | # scripts/dotslash.dotslash is where the version and digest are written down, |
| 4 | # and it stays that way: dist/generated.bzl is derived from it by |
| 5 | # scripts/dotslash-to-buck, so there is one place to bump a version and no |
| 6 | # second copy of a digest to drift. |
| 7 | # |
| 8 | # Only DotSlash is fetched this way. jolt is not, and that is the point: what |
| 9 | # travels to a worker is the fetcher and the manifest, both small, and the |
| 10 | # worker resolves the manifest itself. See android/BUCK. |
| 11 | load("//dist:generated.bzl", "DIST") |
| 12 | |
| 13 | def dist_archive(name, tool, platform): |
| 14 | """One pinned archive, fetched by buck rather than by a shim. |
| 15 | |
| 16 | Unlike DotSlash, which resolves on the machine that runs a tool, this |
| 17 | makes the archive's contents an input: their bytes are in the digest of |
| 18 | every action that reads them, so a new release rebuilds what depends on |
| 19 | it and an unchanged one rebuilds nothing. |
| 20 | """ |
| 21 | entry = DIST[tool][platform] |
| 22 | native.http_archive( |
| 23 | name = name, |
| 24 | urls = [entry["url"]], |
| 25 | sha256 = entry["sha256"], |
| 26 | strip_prefix = entry["strip_prefix"] or None, |
| 27 | type = entry["type"], |
| 28 | visibility = ["PUBLIC"], |
| 29 | ) |
| 30 | |
| 31 | def dotslash_dist(name, platform): |
| 32 | dist_archive(name, "dotslash", platform) |