Metadata-Version: 2.4
Name: spadix-cli
Version: 0.7.9
Summary: A friendly wrapper for colcon
Home-page: https://pronto.ai
Author: Serge Nikulin
Author-email: serge.nikulin@pronto.ai
Maintainer: Serge Nikulin
Maintainer-email: serge.nikulin@pronto.ai
Project-URL: Bug Tracker, https://github.com/Pronto-ai/spadix
Keywords: spadix-cli
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: setuptools
Requires-Dist: lark
Requires-Dist: colcon-common-extensions
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license-file
Dynamic: maintainer
Dynamic: maintainer-email
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# Spadix, a friendly wrapper for `colcon`

Copyright 2021-2024 SafeAI

Copyright 2025 Pronto.AI

## Why?

Our company uses
[`colcon` (from collective construction build manager)](https://colcon.readthedocs.io/en/released/)
as our main build management tool for many years.

While we like this package, it has its problem areas, in our opinion, especially when used by
unexperienced engineers.

- Default build is not a merged one, and this disables Doxygen build
- It is allowed to run from any directory in the project tree, making the tree contaminated with
build artifacts
- By default console output is switched off and switching it back on requires an additional parameter
- It requires few additional parameters to run `gtest` alone

We decided to fix these deficiencies and created a wrapper `spadix` around `colcon`.
Catkin, ament, colcon, spadix... Got it?

## How

`spadix` accepts all `colcon` commands and options plus it adds and modifies few commands on its own.

For `build`, `rebuild`, and `test` (including package-selection variants), `spadix` uses a merged
install by default on all platforms, including Linux, macOS, and Windows. It reads
`.colcon_install_layout` in the directory selected by `--install-base` (`install` by default).
It adds `--merge-install` when that file is missing, contains invalid UTF-8, or contains an
unrecognized layout. A `merged` or `isolated` value in that file is respected: `merged` adds
`--merge-install`, while `isolated` omits it.

`rebuild` reads the layout before cleaning, so it preserves an existing workspace's layout
unless `--no-merge` is set. If cleanup fails, `rebuild` returns the cleanup exit status without
starting the build.
To switch an isolated workspace to the merged default, run `spadix clean` followed by
`spadix build`. Use the same custom base directories for both commands when applicable.

Run commands that share build, install, or log directories sequentially, including direct
`colcon` commands. Spadix does not coordinate concurrent access to these directories.

To create an isolated install in a fresh workspace, run `spadix build --no-merge` or
`spadix --no-merge build`. The option works before or after the command and disables automatic
`--merge-install` insertion, even when the layout marker says `merged`.
To switch an existing merged workspace to isolated,
run `spadix --no-merge rebuild`; this full rebuild removes the install directory first.
Changing layout with `build` or a package-specific `rebuild` requires a full `spadix clean`
first. Build the isolated install before running `spadix --no-merge test`.

Cleanup uses the final values of `--build-base`, `--install-base`, and `--log-base`.
`--build-base` and `--install-base` must follow the spadix command; placing them before it is
rejected. All three options accept `--option path` and `--option=path` forms. Missing, empty,
or dash-prefixed paths are rejected; prefix directory names beginning with `-` with `./`.
For example,
`spadix rebuild --install-base custom` cleans and rebuilds the `custom` install directory.
`--log-base` can appear before or after the spadix command. For commands forwarded to colcon,
including `build`, `rebuild`, and `test`, spadix puts it before the colcon verb. It also selects
the log directory removed by a full `clean` or `rebuild`, but has no effect on `uncrustify` or
`gtest`. For example,
`spadix rebuild --log-base=custom-log --install-base custom` uses `custom-log` for both
cleanup and colcon logging.
On Windows, cleanup treats directory names literally, including shell metacharacters,
and ignores directories that are already absent.

Use one spadix command per invocation; `spadix rebuild` cleans and builds in one invocation.
After `build`, `rebuild`, or `test` (including package-selection variants), bare `build` and
`test` tokens are forwarded as colcon arguments. For example, `spadix build --packages-select test`
and `spadix test --pytest-args -k test` are accepted. Other recognized command tokens, including
package-selection forms such as `test:pkg`, are rejected before any command runs. After
`clean`, `uncrustify`, or `gtest`, every additional recognized command token is rejected.

The `.spadixrc` file in the current directory supplies arguments, one per nonempty line,
before the command-line arguments. Use one command across both sources. If `.spadixrc`
already supplies the command, omit it from the command line.

The wrapper options `--no-merge`, `--no-console`, `--no-root-check`, `--dry-run`, `--ninja`,
and `--non-ninja` can still be supplied at the start of the command line when `.spadixrc`
provides the command. Except for `--no-merge`, put them before any command options, or before the
command when supplying it explicitly. A command-line `--ninja` or `--non-ninja` choice overrides
the choice in `.spadixrc`. Other arguments, including log-base options, retain their original order.
For example, with a `.spadixrc` containing only `build`, run `spadix --no-merge` to create an
isolated install in a fresh workspace.

Usage:

```sh
spadix [Global options] [command] [command options] ...

[Global options]
--no-console  : Do not use the default console mode: `--event-handlers console_cohesion+`
--no-merge  : Do not automatically add `--merge-install`; use before or after the command
--no-root-check  : Do not check that spadix being started from the root of a git project
--ninja  : Explicitly enable Ninja during the build (overrides platform defaults or `--non-ninja`). Ignored if it is not a build
--non-ninja  : Explicitly disable Ninja during the build, even on platforms where Ninja is the default. Ignored if it is not a build

Commands:
clean  :Clean all packages (`rm -rf log install build`)
clean:<package1>[,<package2>...]  :Clean selected, comma separated packages. Spaces not supported

build  :Build all packages
build:<package list>  Build selected, comma separated packages. Spaces not supported
    Build options:
        --release   : RelWithDebInfo (default in Linux)
        --debug   : Debug build (default in windows)
        --no-fif    : disable Failure Injection Framework (FIF enabled by default)

Package list: comma separated list of packages like package1,package2,...
The package list can contain sublists separated by
package selection prefixes `.eq.`, `.le.`, and `.ge.`

rebuild  :Re-build all packages: clean all, then build all.
rebuild:<simple package list>  Re-build selected packages: clean packages, then build them.
Simple package list: comma separated list of packages like package1,package2,...
Simple package list cannot have selection prefixes.

uncrustify  :Uncrustify all packages
uncrustify:<simple package list>  Uncrustify selected packages.

test  :Test all packages
test[:[<package list>][:test]]  :Test selected, comma separated packages,
possibly running `test1` only

Package list: comma separated list of packages like package1,package2,...
The package list can contain sublists separated by
package selection prefixes `.eq.`, `.le.`, and `.ge.`

gtest:<package> [gtest parameters]  :Run gtest only ('<build base>/test_<package name>')

File `.spadixrc` in the current folder contains commands (one per line) that will be added to the
actual command line.
```
