Current section
Files
Jump to
Current section
Files
clingo_elixir
CONTRIBUTING.md
CONTRIBUTING.md
# Maintaining clingo_elixir
Use ASP for modeling. The Elixir API owns native lifetimes and copies results.
Describe changes in terms of the public behavior they affect.
## Build and test
Follow the [native build instructions](MULTIPLATFORM.md).
Use `mix format` for Elixir and `clang-format` for handwritten C. Generate
bindings with Clang and Python.
```sh
tools/bootstrap.sh
export CLINGO_PREFIX="$PWD/_upstream"
CLINGO_RETAINED_COVERAGE=1 mix test
python3 tools/check_generation.py
```
The [validation guide](docs/VALIDATION.md) covers allocation probes, sanitizers,
benchmarks, and package tests.
## Change a binding
Edit the scope and policy files in `tools/`, then run `make generate`.
`api_scope.json` selects retained operations. `api_policy.json` records
ownership, mutability, and array sizes. `callback_sites.json` and
`callback_policy.json` describe callbacks. `ast_constructors.json` records
the constructor signatures that the NIF checks at load.
See the [ABI adapter guide](docs/API.md) and [generated inventory](docs/COVERAGE.md).
For an upstream upgrade, update the commit in `tools/prepare-source.sh` and
replace `c_src/clingo.h` with the tagged header. Review the
[local patches](tools/patches/README.md), regenerate, and test the resulting
runtime. Read the [ownership rules](docs/NATIVE_OWNERSHIP.md) before changing
callbacks, the dispatcher, or resource cleanup.
## Change a lesson
Run the [Livebook checks](livebooks/VALIDATION.md) after editing a lesson.
Update the [course index](livebooks/intro.livemd) when adding or moving a lesson.