How do I run codegen?

Table of Contents

For background on what the generator is and what it generates, see ores.codegen (the component model).

Question

How do I run the ORE Studio C++ code generator?

Answer

There are three entry points depending on scope:

By entity name (preferred for single-entity work)

Resolve by name — no need to know the model file path or component:

./compass.sh codegen entity generate <entity> --address <address>

Examples:

./compass.sh codegen entity generate country --address ores.cpp.qt
./compass.sh codegen entity generate country --address ores.sql.schema
./compass.sh codegen entity generate country --address ores

Omit --address to generate the entity's full supported set — ores is the graph root, so --address ores is equivalent.

Preview what would change without writing:

./compass.sh codegen entity generate country --address ores.cpp.qt --diff
./compass.sh codegen entity generate country --address ores.cpp.qt --dry-run

See How do I generate a codegen entity? for the full workflow.

By model file

Generate from a specific org model file:

./compass.sh codegen generate --model projects/path/to/model.org --address <address>

Across a whole component

Regenerate every entity in a component:

./compass.sh codegen regenerate --component refdata --address ores.cpp
./compass.sh codegen regenerate --component refdata --address ores.sql.schema

Script

All three entry points are implemented in projects/ores.compass/src/compass_codegen_entity.py (entity-name workflow) and cmd_codegen in compass.py (model-file and component-wide workflows).

Tested by

Run ./compass.sh codegen entity generate country --address ores.cpp.qt --dry-run and verify twelve Qt file paths are printed without errors.

See also

Emacs 29.3 (Org mode 9.6.15)