checkout_add_asset()

def checkout_add_asset(name, content, destination, deps, type, platforms, visibility)

Adds an asset to the workspace.

This will create a file in the workspace with the given content as string value.

Args

  • name: string: The name of the rule.
  • content: string: The content of the file to create.
  • destination: string: The destination path for the file.
  • deps: list: List of dependencies for the rule.
  • type: use checkout_type_optional() to skip rule checkout
  • platforms: List of platforms to add the archive to.
  • visibility: Rule visibility: Public|Private|Rules[]. See visbility.star for more info.

checkout_add_cargo_bin()

def checkout_add_cargo_bin(name, crate, version, bins, deps, type, platforms, visibility)

Adds a cargo binary to the workspace.

Args

  • name: string: The name of the rule.
  • crate: string: The name of the crate.
  • version: string: The version of the crate.
  • bins: list: List of binaries to add.
  • deps: list: List of dependencies for the rule.
  • type: use checkout_type_optional() to skip rule checkout
  • platforms: List of platforms to add the archive to.
  • visibility: Rule visibility: Public|Private|Rules[]. See visbility.star for more info.

checkout_add_hard_link_asset()

def checkout_add_hard_link_asset(name, source, destination, deps, type, platforms, visibility)

Adds a hard link asset to the workspace.

Args

  • name: string: The name of the rule.
  • source: string: The source path of the asset.
  • destination: string: The destination path for the asset.
  • deps: list: List of dependencies for the asset.
  • type: use checkout_type_optional() to skip rule checkout
  • platforms: List of platforms to add the archive to.
  • visibility: Rule visibility: Public|Private|Rules[]. See visbility.star for more info.

checkout_add_soft_link_asset()

def checkout_add_soft_link_asset(name, source, destination, deps, type, platforms, visibility)

Adds a soft link asset to the workspace.

Args

  • name: string: The name of the rule.
  • source: string: The source path of the soft link.
  • destination: string: The relative workspace path of the soft link destination.
  • deps: list: List of dependencies for the asset.
  • type: use checkout_type_optional() to skip rule checkout
  • platforms: List of platforms to add the archive to.
  • visibility: Rule visibility: Public|Private|Rules[]. See visbility.star for more info.

checkout_add_target()

def checkout_add_target(name, deps, type, platforms, visibility)

Adds a target to the workspace.

Args

  • name: string: The name of the rule.
  • deps: list: List of dependencies for the target.
  • type: use checkout_type_optional() to skip rule checkout
  • platforms: List of platforms to add the archive to.
  • visibility: Rule visibility: Public|Private|Rules[]. See visbility.star for more info.

checkout_add_which_asset()

def checkout_add_which_asset(name, which, destination, deps, platforms, type, visibility)

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: string: The name of the rule.
  • which: string: The name of the asset to add.
  • destination: string: The destination path for the asset.
  • deps: list: List of dependencies for the asset.
  • platforms: List of platforms to add the archive to.
  • type: use checkout_type_optional() to skip rule checkout
  • visibility: Rule visibility: Public|Private|Rules[]. See visbility.star for more info.

checkout_update_env()

def checkout_update_env(name, vars, paths, system_paths, inherited_vars, optional_inherited_vars, run_inherited_vars, secret_inherited_vars, deps, type, platforms, visibility)

Updates the environment with the given variables and paths.

Variables other than PATH are added as key/value pairs. 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.

All vars are fixed at checkout time except vars specified in run_inherited_vars. Checkout vars are stored in the new workspace in env.spaces.star. run_inherited_vars are inherited when executing spaces run. secret_inherited_vars are inherited when executing spaces checkout or run. The values of the secrets are masked in the logs and terminal.

Args

  • name: string: The name of the rule.
  • vars: dict: Dictionary of variables to store in env.spaces.star.
  • paths: list: List of paths to add to the PATH.
  • system_paths: The path to add to the system PATH.
  • inherited_vars: List of variables to inherit from the calling environment and store in env.spaces.star.
  • optional_inherited_vars: List of variables to inherit from the calling environment if they exist and store in env.spaces.star (requires spaces >v0.15.1)
  • run_inherited_vars: List of variables inherited when executing spaces run.
  • secret_inherited_vars: List of variables inherited when executing spaces checkout/run. Values will be masked in the logs and terminal.
  • deps: list: List of dependencies for the rule.
  • type: use checkout_type_optional() to skip rule checkout
  • platforms: List of platforms to add the archive to.
  • visibility: Rule visibility: Public|Private|Rules[]. See visbility.star for more info.

update_platforms_prefix()

def update_platforms_prefix(platforms, add_prefix) -> dict

Updates the prefix of the platforms.

Args

  • platforms: dict: List of platforms to add the archive to.
  • add_prefix: string: The prefix to set.

Returns

An updated list of platforms.