checkout_add_archive()
def checkout_add_archive(name, url, sha256, link, includes, excludes, strip_prefix, add_prefix, filename, platforms, type, deps)
Adds an archive to the workspace.
The archive is downloaded to the spaces store and hard-linked to the workspace.
Args
name
-str
The name of the rule.url
-str
The URL of the archive to download.sha256
-str
The SHA256 checksum of the archive.link
- Hard | Noneincludes
-[str]
List of globs to include.excludes
-[str]
List of globs to exclude.strip_prefix
-str
Prefix to strip from the archive.add_prefix
-str
Prefix to add to the archive.filename
-str
The filename if it isn’t the last part of the URLplatforms
-[str]
List of platforms to add the archive to.type
-str
use checkout_type_optional() to skip rule checkoutdeps
-[str]
List of dependencies for the rule.
checkout_add_asset()
def checkout_add_asset(name, content, destination, deps, type, platforms)
Adds an asset to the workspace.
This will create a file in the workspace with the given content as string value.
Args
name
-str
The name of the rule.content
-str
The content of the file to create.destination
-str
The destination path for the file.deps
-[str]
List of dependencies for the rule.type
-str
use checkout_type_optional() to skip rule checkoutplatforms
-[str]
List of platforms to add the archive to.
checkout_add_cargo_bin()
def checkout_add_cargo_bin(name, crate, version, bins, deps, type, platforms)
Adds a cargo binary to the workspace.
Args
name
- The name of the rule.crate
- The name of the crate.version
- The version of the crate.bins
- List of binaries to add.deps
-[str]
List of dependencies for the rule.type
-str
use checkout_type_optional() to skip rule checkoutplatforms
-[str]
List of platforms to add the archive to.
checkout_add_hard_link_asset()
def checkout_add_hard_link_asset(name, source, destination, deps, type, platforms)
Adds a hard link asset to the workspace.
Args
name
- The name of the rule.source
- The source path of the asset.destination
- The destination path for the asset.deps
-[str]
List of dependencies for the asset.type
-str
use checkout_type_optional() to skip rule checkoutplatforms
-[str]
List of platforms to add the archive to.
checkout_add_oras_archive()
def checkout_add_oras_archive(name, url, artifact, tag, add_prefix, manifest_digest_path, manifest_artifact_path, globs, deps, type, platforms)
Adds an oras archive to the workspace.
Args
name
-str
The name of the rule.url
-str
The URL of the oras archive to download.artifact
-str
The artifact name of the oras archive.tag
-str
The tag of the oras archive.add_prefix
-str
The prefix to add to the archive.manifest_digest_path
-str
The path to the manifest digest in the oras archive.manifest_artifact_path
-str
The path to the manifest artifact in the oras archive.globs
- List of globs to include/exclude.deps
-[str]
List of dependencies for the rule.type
-str
use checkout_type_optional() to skip rule checkoutplatforms
-[str]
List of platforms to add the archive to.
checkout_add_platform_archive()
def checkout_add_platform_archive(name, platforms, deps, type)
Adds a platform archive to the checkout.
Platform archives are used to add binary tools based on the host platform.
Args
name
-str
The name of the rule.platforms
-[str]
List of platforms to add the archive to.deps
-[str]
List of dependencies for the rule.type
-str
use checkout_type_optional() to skip rule checkout
checkout_add_repo()
def checkout_add_repo(name, url, rev, checkout_type, clone, is_evaluate_spaces_modules, sparse_mode, sparse_list, working_directory, platforms, type, deps)
Clones a repository and checks it out at a specific revision.
The for clone=checkout_clone_default() | checkout_clone_blobless()
, the repo
is cloned first to the store and then copied to the workspace. If the filesystem
supports copy-on-write (COW) semantics, COW semantics are used to copy from the
store to the workspace.
Example:
checkout_add_repo(
"spaces",
url = "https://github.com/work-spaces/spaces",
rev = "main"
)
Args
name
-str
The name of the rule. This is also the location of the new repo in the workspace.url
-str
The git repository URL to clonerev
-str
The branch or commit hash to checkoutcheckout_type
-enum
Revisionclone
-enum
checkout_clone_default() | checkout_clone_blobless() | checkout_clone_worktree()is_evaluate_spaces_modules
-bool
Whether to evaluate spaces.star files in the repo (default is True).sparse_mode
-enum
Cone | NoConesparse_list
-[str]
List of paths to include/excludeworking_directory
-str
The working directory to clone the repository into.platforms
-[str]
List of platforms to add the repo to.type
-str
use checkout_type_optional() to skip rule checkoutdeps
-[str]
List of dependencies for the rule.
checkout_add_soft_link_asset()
def checkout_add_soft_link_asset(name, source, destination, deps, type, platforms)
Adds a soft link asset to the workspace.
Args
name
-str
The name of the rule.source
-str
The source path of the soft link.destination
-str
The relative workspace path of the soft link destination.deps
-[str]
List of dependencies for the asset.type
-str
use checkout_type_optional() to skip rule checkoutplatforms
-[str]
List of platforms to add the archive to.
checkout_add_target()
def checkout_add_target(name, deps, type, platforms)
Adds a target to the workspace.
Args
name
-str
The name of the rule.deps
-[str]
List of dependencies for the target.type
-str
use checkout_type_optional() to skip rule checkoutplatforms
-[str]
List of platforms to add the archive to.
checkout_add_which_asset()
def checkout_add_which_asset(name, which, destination, deps, platforms, type)
Adds an asset to the destintion based on the which command.
Using this function creates system dependencies that may not be reproducible across different systems.
Args
name
- The name of the rule.which
- The name of the asset to add.destination
- The destination path for the asset.deps
-[str]
List of dependencies for the asset.platforms
-[str]
List of platforms to add the archive to.type
-str
use checkout_type_optional() to skip rule checkout
checkout_clone_blobless()
def checkout_clone_blobless()
Use checkout_add_repo(clone = checkout_clone_blobless())
to filter unused files from the repository history.
Returns
str: CHECKOUT_CLONE_BLOBLESS
checkout_clone_default()
def checkout_clone_default()
Use checkout_add_repo(clone = checkout_clone_default())
for a normal git clone.
Returns
str: CHECKOUT_CLONE_DEFAULT
checkout_clone_shallow()
def checkout_clone_shallow()
Use checkout_add_repo(clone = checkout_clone_shallow())
for a shallow clone. Note: The rev must be a branch, not a tag or commit.
Returns
str: CHECKOUT_CLONE_SHALLOW
checkout_clone_worktree()
def checkout_clone_worktree()
Use checkout_add_repo(clone = checkout_clone_worktree())
to store the bare repository in the spaces store.
Returns
str: CHECKOUT_CLONE_WORKTREE
checkout_sparse_mode_cone()
def checkout_sparse_mode_cone()
Use checkout_add_repo(sparse_mode = checkout_sparse_mode_cone())
for sparse cone mode.
Returns
str: CHECKOUT_SPARSE_MODE_CONE
checkout_sparse_mode_no_cone()
def checkout_sparse_mode_no_cone()
Use checkout_add_repo(sparse_mode = checkout_sparse_mode_no_cone())
for sparse no-cone mode. This mode uses gitignore-like expressions for sparse checkout.
Returns
str: CHECKOUT_SPARSE_MODE_NO_CONE
checkout_type_default()
def checkout_type_default()
Use checkout_add_repo(type = checkout_type_default())
to use default checkout behavior
Returns
None: CHECKOUT_TYPE_DEFAULT
checkout_type_optional()
def checkout_type_optional()
Use checkout_add_repo(type = checkout_type_optional())
to skip checkout
Returns
str: CHECKOUT_TYPE_OPTIONAL
checkout_update_asset()
def checkout_update_asset(name, destination, value, format, deps, type, platforms)
Updates an asset in the workspace.
This rule will merge the data of an existing JSON, TOML, or YAML file with the given value.
Args
name
- The name of the rule.destination
- The destination path for the asset.value
- The value of the asset as a dict to merge with the existing file.format
- The format of the asset (json | toml | yaml). Default will get extension from destination.deps
-[str]
List of dependencies for the asset.type
-str
use checkout_type_optional() to skip rule checkoutplatforms
-[str]
List of platforms to add the archive to.
checkout_update_env()
def checkout_update_env(name, vars, paths, system_paths, inherited_vars, deps, type, platforms)
Updates the environment with the given variables and paths.
Variables other than PATH are added as a hash map. PATH is added as a list of values. The order
of the PATHS is based on execution order which can be controlled using deps. The system_paths
are added after the paths
values.
Args
name
-str
The name of the rule.vars
-dict
Dictionary of environment variables to set.paths
-[str]
List of paths to add to the PATH.system_paths
-[str]
The path to add to the system PATH.inherited_vars
- List of environment variables to inherit from the calling environment.deps
-[str]
List of dependencies for the rule.type
-str
use checkout_type_optional() to skip rule checkoutplatforms
-[str]
List of platforms to add the archive to.
update_platforms_prefix()
def update_platforms_prefix(platforms, add_prefix)
Updates the prefix of the platforms.
Args
platforms
-[str]
List of platforms to add the archive to.add_prefix
- The prefix to set.
Returns
An updated list of platforms.