Invoke

Nyb is distributed as a binary executable with a command-line interface. This page details its commands and options.

Usage

nyb [global options] <command> [options]

where command is one of run or copy_cache. The options are specified in each of the command sections. The global options are given below.

Global options

OptionDescriptionFormatExample
--cwd . Working directory where the monorepo lies. By default it is the current working directory ("."). Directory name, either absolute, or relative to the working directory. .
--config .nybrc.toml Configuration file, in TOML format. The spec is detailed here. By default, the configuration is grabbed from the .nybrc.toml file in the working directory. File name, either absolute, or relative to the working directory. .nybrc.toml
--stream Disable interactive logging. Flag. --stream

nyb run

Runs the rules in the dependency graph, in the right order, with parallelism, and caching.

Examples

# Run all the rules
nyb run

# Run the rules with the specific tags
nyb run --tags=build

# Run the rules without the specific tags
nyb run "--tags=!build"

# Run the rule for a specific target
nyb run --targets=//path/to:target

# Run the rule for all the targets in a package and its subpackages
nyb run --targets=//package/...

# The options can be combined
nyb run --tags=build --targets=//path/to:target,//package/...

Usage

nyb [global options] run [options]

The global options are given in another section. The command-specific options are given below.

Options

OptionDescriptionFormatExample
--targets target,... Limit the dependency graph to these targets. The transitive dependencies are also inspected. Comma-separated list of targets or target prefixes. //path/to:target,
//package/...
--tags Limit the dependency graph to the targets holding these tags. The transitive dependencies are also inspected. Comma-separated list of tags. Use !docker to exclude all the targets holding a specific tag (here, docker). build,test,!docker
--invalidate target,... Invalidate the specific targets: they will be rebuilt even if their output has been cached. Comma-separated list of targets. Note that target prefixes are not allowed here. //path/to:target,
//path/to:target2
--invalidate_all Invalidate all the targets that are transitively included with --targets and --tags. Flag. --invalidate_all
--deps Limit the dependency graph to the direct dependencies of the targets, as specified with --targets, and their transitive dependencies. Do not process the targets themselves. Flag. --deps
--local Ensure that the outputs of the given targets are present locally, downloading them if they are cached. The default behavior (--no-local) is to only download artifacts from cache that are needed for building or testing dependent targets. Flag. --local

nyb copy_cache

Copies entries from one cache to another cache.

Examples

# Copy into `cache2` the actions in `cache1` (and their outputs) whose
# digests are listed in `action_digests.txt`.
nyb copy_cache --action_digests=action_digests.txt --from=cache1 --to=cache2

Usage

nyb [global options] copy_cache [options]

The global options are given in another section. The command-specific options are given below.

Options

OptionDescriptionFormatExample
--action_digests filename Filename, absolute or relative to the working directory, where the action digests are located. Defaults to the Execution.ActionDigestsOutputFile entry in the global config. Filename. digests.txt
--from Name of the cache to copy from. The meaning depends on the cache backend. Defaults to the cache in the global config. Backend-specific cache name. cache1
--to (mandatory) Name of the cache to copy to. The meaning depends on the cache backend. Backend-specific cache name. cache2