5 ms·
How is the version information included in the software if you don't include it in the source? Do you have a deploy script that modifies source based on the git
by jonnycomputer 4y ago
How is the version information included in the software if you don't include it in the source? Do you have a deploy script that modifies source based on the git tag, or ?
- t0astbread 4y agoSome languages and build systems also allow you to set constants from compiler flags (Go for example). Other systems make the entire build configuration an executable program (Gradle).
- jonnycomputer 4y agoI did not know that. I mostly use interpreted languages (Python, JavaScript, etc.)
- formerly_proven 4y agoFor Python there are tools like setuptools_scm to completely automate the setup of this.
- jonnycomputer 4y agoGood to know.
- WorldMaker 4y agoI sometimes dump git describe to a JSON file rather than modifying a source file and let the build bundle it as an embedded resource. You can .gitignore the JSON file to keep it from accidentally getting checked in (and causing merge conflicts). As also pointed out, many build tools that want or need version numbers often also have command line flags or can take environment variables instead of using source files.
- jonnycomputer 4y agoThere seems a lot to like about that approach.
- zbuf 4y agoThe build process uses the tag. In practice that's a tiny bit more complicated to do it really well, with the version as a dependency in the build process. When developing, you don't want to trigger a full rebuild if the version number changes, but you do have rebuilds to do when it does.