Assets
Assets are remote or local files that are inputs to a build. All assets have SHA-1 or SHA-256 checksums.
Assets are accessed with the get-asset command described in a later section of the document.
Asset Identity
Section titled “Asset Identity”Assets are located with one or more URL or file path mirrors:
| Scheme | What |
|---|---|
https:// | HTTP over TLS web asset |
http:// | HTTP web asset |
cell:// | Cell asset |
file:// | Local asset |
| none | Local asset |
Assets are also created on-demand:
| Location | What |
|---|---|
dk.u | Workspace asset |
Each asset is uniquely identified by its SHA256 checksums. That unique identification means that mirrors for assets can be added at any time (including in the future) without triggering rebuilds.
Web assets
Section titled “Web assets”Examples:
https://example.com/asset1.ziphttp://example.com/asset2/Cell assets
Section titled “Cell assets”Examples:
cell://root/etc/table/dotnetCells are local directories within the project structure. The root cell is predefined to be the working directory that the build system was called from.
For example, cell://root/etc/table/dotnet is the local directory etc/table/dotnet within the cell root.
Workspace assets
Section titled “Workspace assets”Assets are created by dk.u workspace script's unified.asset declarations. The module-version in the non-workspace section title becomes the base of the asset.
So:
### CommonsBase_GNU.Make.Apparatus@4.4.1
% unified.asset { name="BuildW32Bat", file="assets/p/patched-make-build_w32.bat" } 'asset' '11131' 'sha256:3f9825744b486bc5413806cccbae36a4d354e944765fba68c26d37884369a06d'creates an asset CommonsBase_GNU.Make.Apparatus.BuildW32Bat@4.4.1 with path -p assets/p/patched-make-build_w32.bat.
Self assets
Section titled “Self assets”Examples:
selfasset://test-originprovides access to custom Lua rule assets described in later sections like in the following example:
local M = { id = "OurTest_Exec.PostObject.TestRequest@1.0.0" }rules = build.newrules(M)function rules.EchoRequest(command, request) local path = "a/path" if command == "submit" then local file = request.io.open("some/asset/file", "w") request.io.write(file, "This is my asset!\n") local origin, asset = request.io.toasset(file, { path = path, origin_name = "test-origin" }) return { submit = { values = { schema_version = { major = 1, minor = 0 }, bundles = { { id = request.submit.outputid, listing = { origins = { origin } }, assets = { asset } } } } } } endend
return Mrequest.io.toasset creates the selfasset URLs on-demand.
Local assets
Section titled “Local assets”Examples:
file://C:/sourceC:\sourcefile:///usr/src/main.tar.gz/usr/src/main.tar.gza/b/cA local asset may be either:
- a file
- a directory
A relative file or directory is relative to the workspace directory.
A local directory path is always zipped into a zip archive file, where the Zip Archive Reproducibility (next section) standards will be followed.
Zip Archive Reproducibility
Section titled “Zip Archive Reproducibility”For reproducibility, the generated zip archive file will:
- have the zip last modification time to the earliest datetime (Jan 1, 1980 00:00:00)
- have each zip entry with its modification time to the earliest datetime (Jan 1, 1980 00:00:00)
- have each zip file entry set its extended attribute to be a "regular file" with
rw-r--r--permissions - use zip compression level 5, even for tiny file entries. That is: "compression method: (2 bytes) ... 5 - The file is Reduced with compression factor 4" at IANA application/zip
- always accompany a zip directory entry with a zip64 directory entry
Loading Assets
Section titled “Loading Assets”The asset key of get-asset:
get-asset MODULE@VERSION -p PATHhas the components:
- MODULE: Module ID
- VERSION: Module Version
- PATH: Asset path
The first two (2) components uniquely identify a bundle while the third component uniquely identifies the asset within a bundle like:
"bundles": [ // This is bundle identified by id = MODULE@VERSION { "id": "DkDistribution_Std.Bundle@2.4.202508011516-signed", "listing": { "origins": [ { "name": "github-release", "mirrors": [ "https://github.com/diskuv/dk/releases/download/2.4.202508011516-signed" ] } ] }, "assets": [ // This is the asset identified by path = PATH { "origin": "github-release", "path": "SHA256.sig", "size": 151, "checksum": { "sha256": "0d281c9fe4a336b87a07e543be700e906e728becd7318fa17377d37c33be0f75" } } ] }]