Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make codegen step optional for the DFHack build #5137

Open
myk002 opened this issue Dec 25, 2024 · 1 comment
Open

Make codegen step optional for the DFHack build #5137

myk002 opened this issue Dec 25, 2024 · 1 comment

Comments

@myk002
Copy link
Member

myk002 commented Dec 25, 2024

Codegen requires contributors to install an additional dependency (Perl). For people who are not doing direct structures work (which is far less frequent now that we get bay12 headers), this is just extra steps and extra trouble.

Moreover, codegen takes significant time to complete in Windows CI builds (where file access is much slower due to multiple layers of emulation).

These two benefits could reasonably justify checking generated code into source control (which is a perennially hotly debated topic), as long as it doesn't unduly impact developer velocity.

We might be able to push the header generation process to an independent build step. One that can be executed outside of the context of the main dfhack build. However, we should still keep the option to generate code as part of the build to facilitate actual xml development.

One idea is to put codegen behind a CMake option (BUILD_CODEGEN) and run that as part of CI in the main repo whenever the structures ref is updated. Generated header files would be checked directly into the main repo (that is, the .gitignore file in library/include/df would be removed). Developers who are editing the xml files would keep exactly the same flow as before for local builds, and could choose to do a PR to update the generated header files or just submit the xml changes and let CI handle the header updates automatically.

Manual process:

  • edit xml files in df-structures
  • do a build (with BUILD_CODEGEN=1)
  • merge xml files in df-structures
  • in same commit, update the xml ref and commit the updated header files in the main repo
  • merge main repo changes

Automated process:

  • edit xml files in df-structures
  • merge xml files to df-structures
  • CI automatically updates xml ref, runs build with BUILD_CODEGEN=1, and autoupdates the headers in the main repo (all this is done in the same workflow to ensure atomic updates)

Then, non-structures developers and all other CI builds (test, package, github-release, steam-release, etc.) can build with BUILD_CODEGEN=0.

@myk002 myk002 changed the title move codegen step out of the DFHack build Make codegen step optional for the DFHack build Dec 25, 2024
@dhthwy
Copy link
Contributor

dhthwy commented Dec 26, 2024

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants