Build Steps That Generate Source or Data

Generated files come from a declared procedure and input set. Decide how and when the repository or build should verify their contents.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace one change
  2. Verify consistency in review
  3. Make generated outputs depend on their real source
  4. Verify clean and rebuilt states

Trace one change

A schema revision may require a new parser table. Updating the schema alone can leave checked-in generated output stale. The declared build dependencies identify that source-to-result relationship.

Verify consistency in review

Regenerate from the checked-in inputs and compare the expected result. If the generator includes timestamps, choose an equality appropriate to the artifact. See generated artifacts in Git.[1]

Make generated outputs depend on their real source

A generator reads a settings schema and emits enum definitions. The compiler depends on the definitions. A changed generator version can also change the form of the code even with an identical schema. See declared build targets.

Schema + generator version → generated enum file
Generated enum + program source → compiled program
Stable inputs under a deterministic generator produce the same definitions

Verify clean and rebuilt states

If generated output is tracked, verify it can be reproduced from checked-in inputs. If untracked, confirm clean setup knows how to create it. Test a schema change and a generator change separately.

References

  1. Free Software Foundation, GNU Make Manual ↩