run_add()
def run_add(name, deps, help, type, platforms, visibility)Adds a rule to the workspace with no associated command.
This rule can be used to consolidate dependencies into a single rule.
Args
name: string: The name of the rule.deps: list: List of dependencies for the target.help: The help message for the rule.type: See run_add_exec()platforms: List of platforms to build the target for (default is all).visibility: Rule visibility:Public|Private|Rules[]. See visibility.star for more info.
run_add_archive()
def run_add_archive(name, archive_name, deps, version, source_directory, suffix, includes, excludes, platform, visibility)Adds an archive target to the workspace.
This rule can be used to consolidate dependencies into a single target.
Args
name: string: The name of the rule.archive_name: string: The base name of the archive that will be createddeps: list: List of dependencies to run withspaces runversion: string: The version of the archive.source_directory: string: The directory containing the source files to archive.suffix: string: The archive suffix (tar.gz or zip for examples)includes: List of globs to include in the archive.excludes: List of globs to exclude from the archive.platform: The platform to build the target for (default is all).visibility: Rule visibility:Public|Private|Rules[]. See visibility.star for more info.
Returns
A tuple containing (
run_add_exec()
def run_add_exec(name, command, help, args, env, deps, inputs, target_files, target_dirs, type, working_directory, platforms, log_level, redirect_stdout, timeout, visibility, expect)Adds a command to the run dependency graph
Args
name: string: The name of the rule.command: string: The command to execute.help: The help message for the rule.args: list: The arguments to pass to the command.env: dict: key value pairs of environment variablesdeps: list: The rule dependencies that must be run before this commandinputs: List of globs to specify the inputs. If the inputs are unchanged, the command will not run.target_files: A list of files created by this ruletarget_dirs: A list of directories populated by this ruletype: The exec type (Run|Setup|Optional (default)|PreCommit|Clean|Test)working_directory: The directory to run the command (default is workspace root).platforms: Platforms to run on (default is all).log_level: The log level to use None|App|Passthroughredirect_stdout: The file to redirect stdout to (prefer to parse the log file).timeout: Number of seconds to run before sending a kill signal.visibility: Rule visibility:Public|Private|Rules[]. See visibility.star for more info.expect: string: The expected result of the command Success|Failure|Any. (default is Success)
run_add_exec_clean()
def run_add_exec_clean(name, command, help, args, env, deps, inputs, working_directory, platforms, log_level, redirect_stdout, timeout, visibility, expect)Adds a command as a clean rule.
All test rules can be executed with:
spaces run //:cleanArgs
name: string: The name of the rule.command: string: The command to execute.help: The help message for the rule.args: list: The arguments to pass to the commandenv: dict: key value pairs of environment variablesdeps: list: The rule dependenciesinputs: List of globs to specify the inputs. If the inputs are unchanged, the command will not run.working_directory: The directory to run the command (default is workspace root).platforms: Platforms to run on (default is all).log_level: The log level to use None|Appredirect_stdout: The file to redirect stdout to (prefer to parse the log file).timeout: Number of seconds to run before sending a kill signal.visibility: Rule visibility:Public|Private|Rules[]. See visibility.star for more info.expect: string: The expected result of the command Success|Failure|Any. (default is Success)
run_add_exec_precommit()
def run_add_exec_precommit(name, command, help, args, env, deps, inputs, working_directory, platforms, log_level, redirect_stdout, timeout, visibility, expect)Adds a command as a pre-commit rule.
All pre-commit rules can be executed with:
spaces run //:pre-commitArgs
name: string: The name of the rule.command: string: The command to execute.help: The help message for the rule.args: list: The arguments to pass to the commandenv: dict: key value pairs of environment variablesdeps: list: The rule dependenciesinputs: List of globs to specify the inputs. If the inputs are unchanged, the command will not run.working_directory: The directory to run the command (default is workspace root).platforms: Platforms to run on (default is all).log_level: The log level to use None|Appredirect_stdout: The file to redirect stdout to (prefer to parse the log file).timeout: Number of seconds to run before sending a kill signal.visibility: Rule visibility:Public|Private|Rules[]. See visibility.star for more info.expect: string: The expected result of the command Success|Failure|Any. (default is Success)
run_add_exec_setup()
def run_add_exec_setup(name, command, help, args, env, deps, working_directory, platforms, log_level, redirect_stdout, timeout, visibility, expect)Adds a command as a setup rule. It will run only once and all run rules will depend on it.
All setup rules can be executed with:
spaces run //:setupArgs
name: string: The name of the rule.command: string: The command to execute.help: The help message for the rule.args: list: The arguments to pass to the commandenv: dict: key value pairs of environment variablesdeps: list: The rule dependenciesworking_directory: The directory to run the command (default is workspace root).platforms: Platforms to run on (default is all).log_level: The log level to use None|Appredirect_stdout: The file to redirect stdout to (prefer to parse the log file).timeout: Number of seconds to run before sending a kill signal.visibility: Rule visibility:Public|Private|Rules[]. See visibility.star for more info.expect: string: The expected result of the command Success|Failure|Any. (default is Success)
run_add_exec_test()
def run_add_exec_test(name, command, help, args, env, deps, inputs, working_directory, platforms, log_level, redirect_stdout, timeout, visibility, expect)Adds a command as a test rule.
All test rules can be executed with:
spaces run //:testArgs
name: string: The name of the rule.command: string: The command to execute.help: The help message for the rule.args: list: The arguments to pass to the commandenv: dict: key value pairs of environment variablesdeps: list: The rule dependenciesinputs: List of globs to specify the inputs. If the inputs are unchanged, the command will not run.working_directory: The directory to run the command (default is workspace root).platforms: Platforms to run on (default is all).log_level: The log level to use None|Appredirect_stdout: The file to redirect stdout to (prefer to parse the log file).timeout: Number of seconds to run before sending a kill signal.visibility: Rule visibility:Public|Private|Rules[]. See visibility.star for more info.expect: string: The expected result of the command Success|Failure|Any. (default is Success)
run_add_from_clone()
def run_add_from_clone(name, clone_from, deps, help, type, visibility)Adds a rule that clones the exec from an existing rule.
The new rule is merged with the cloned rule: the new rule’s fields take precedence, and the exec/target is taken from the cloned rule. Dependencies are extended (not replaced).
Args
name: string: The name of the new rule.clone_from: string: The name of an existing rule to clone the exec from.deps: list: Additional dependencies to add to the cloned rule’s dependencies.help: The help message for the rule (defaults to cloned rule’s help).type: The exec type (Run|Setup|Optional (default)|PreCommit|Clean|Test). Defaults to cloned rule’s type.visibility: Rule visibility:Public|Private|Rules[]. See visibility.star for more info.
run_add_kill_exec()
def run_add_kill_exec(name, target, signal, help, expect, deps, type, platforms, visibility)Adds a target that will send a signal to another target.
Args
name: string: The name of the rule.target: string: The name of the rule to kill.signal: string: The signal to send to the target.help: The help message for the rule.expect: string: The expected result of the kill. (default is Success)deps: list: Run rule dependencies.type: See run_add_exec()platforms: Platforms to run on (default is all).visibility: Rule visibility:Public|Private|Rules[]. See visibility.star for more info.
run_add_serialized()
def run_add_serialized(name, rules, deps, help, type, visibility)Takes a list of existing rules and creates a serial execution chain.
The first rule in the list is not cloned. Each subsequent rule is cloned with an additional dependency on the previous rule in the chain, ensuring they execute one after another in order.
The cloned rules are named <name>_<index> where <index> is the position
in the list (starting from 1).
Args
name: string: The base name used to derive cloned rule names (<name>_1,<name>_2, …).rules: list: List of existing rule names to serialize.deps: list: Additional dependencies to add to every cloned rule.help: The help message for cloned rules (defaults to cloned rule’s help).type: The exec type (Run|Setup|Optional (default)|PreCommit|Clean|Test). Defaults to cloned rule’s type.visibility: Rule visibility:Public|Private|Rules[]. See visibility.star for more info.
run_add_target()
def run_add_target(name, deps, help, type, platforms, visibility)Adds a target to the workspace.
This rule can be used to consolidate dependencies into a single target.
Args
name: string: The name of the rule.deps: list: List of dependencies for the target.help: The help message for the rule.type: See run_add_exec()platforms: List of platforms to build the target for (default is all).visibility: Rule visibility:Public|Private|Rules[]. See visibility.star for more info.
run_add_target_precommit()
def run_add_target_precommit(name, deps, help, platforms, visibility)Adds a target to the workspace that //:pre-commit will depend on.
This rule can be used to consolidate PreCommit dependencies into a single target.
Args
name: string: The name of the rule.deps: list: List of dependencies for the target.help: The help message for the rule.platforms: List of platforms to build the target for (default is all).visibility: Rule visibility:Public|Private|Rules[]. See visibility.star for more info.
run_add_target_test()
def run_add_target_test(name, deps, help, platforms, visibility)Adds a target to the workspace that //:test will depend on.
This rule can be used to consolidate test dependencies into a single target.
Args
name: string: The name of the rule.deps: list: List of dependencies for the target.help: The help message for the rule.platforms: List of platforms to build the target for (default is all).visibility: Rule visibility:Public|Private|Rules[]. See visibility.star for more info.
run_add_to_all()
def run_add_to_all(name, deps, visibility)Creates a target rule called name with deps and part of :all.
Targets will run with spaces run or spaces run //:all.
Args
name: string: The name of the rule.deps: list: List of dependencies to run withspaces runvisibility: Rule visibility:Public|Private|Rules[]. See visibility.star for more info.
run_expect_any()
def run_expect_any()Expect the command to succeed or fail.
spaces exits successfully if the command succeeds or fails.
Returns
str: “Any”
run_expect_failure()
def run_expect_failure()Expect the command to fail.
If the command fails and is expected to fail, spaces exits successfully.
Returns
str: “Failure”
run_expect_success()
def run_expect_success()Expect the command to succeed
Returns
str: “Success”
run_inputs_always()
def run_inputs_always()Assign inputs to None to run the command every time.
Returns
None
run_inputs_once()
def run_inputs_once()Assign inputs to [] to run the command once.
Returns
list: []
run_log_level_app()
def run_log_level_app()Print the output of the run rule while running spaces
Returns
str: “App”
run_log_level_passthrough()
def run_log_level_passthrough()Print the output of the run rule while running spaces with no additional markings
Returns
str: “Passthrough”
run_signal_abort()
def run_signal_abort()Gets the Abort signal
run_signal_alarm()
def run_signal_alarm()Gets the Alarm signal
run_signal_hup()
def run_signal_hup()Gets the Hangup signal
run_signal_int()
def run_signal_int()Gets the Interrupt signal
run_signal_kill()
def run_signal_kill()Gets the Kill signal
run_signal_quit()
def run_signal_quit()Gets the Quit signal
run_signal_terminate()
def run_signal_terminate()Gets the Terminate signal
run_signal_user1()
def run_signal_user1()Gets the User1 signal
run_signal_user2()
def run_signal_user2()Gets the User2 signal
run_type_all()
def run_type_all()Assign type to Run to run the command with spaces run.
The rules marked as Run are part of the //:all target.
spaces run //:allReturns
str: “Run”
run_type_precommit()
def run_type_precommit()The rules added as PreCommit are part of the //:pre-commit target.
spaces run //:pre-commitReturns
str: “PreCommit”
run_type_setup()
def run_type_setup()The rules added as Setup are part of the //:setup target.
spaces run //:setupReturns
str: “Setup”
run_type_test()
def run_type_test()The rules added as Test are part of the //:test target.
spaces run //:testReturns
str: “Test”