Update to gen-package-version:
https://github.com/Abscissa/gen-package-version
Automatically generate a D module with version and timestamp information
(detected from git or Mercurial/hg) every time your program or library
is built. You can also generate a DDOC macro file (using the --ddoc=dir
switch.) In-between builds will automatically have their own
VCS-generated version number, including the VCS commit hash.
Now, by default, gen-package-version will NOT re-generate the output
files if the only difference is the build timestamp. So it won't trigger
unnecessary rebuilds of your project.
Usage is easy. Pop this in your dub.json:
--
dependencies: {
gen-package-version: ~1.0.0
},
preGenerateCommands:
[dub run gen-package-version -- your.package.name --root=$PACKAGE_DIR
--src=path/to/src]
--
And then import:
--
import your.package.name.packageVersion;
writeln(My Cool Program , packageVersion);
writeln(Built on , packageTimestamp);
--
Full changelog:
https://github.com/Abscissa/gen-package-version/blob/master/CHANGELOG.md
New in this version:
- Change: The generated 'packageTimestamp' is changed from ISOExt format
to human readable. The ISOExt formatted version is now called
'packageTimestampISO'.
- Change: Value for '--module=' is no longer allowed to contain periods.
- Enhancement: Basic ability to be used as a library. See the README for
details.
- Enhancement: Add '-r|--root' to support projects in any directory, not
just the current directory.
- Enhancement: Minor improvements to '--verbose' and '--trace' outputs.
- Fixed: Don't update the version file (and thus trigger a project
rebuild) if the version file doesn't need updated. Bypass this check
with the new '--force' flag.
- Fixed: Don't rebuild gen-package-version if not needed.
- Fixed: Failure on Windows when target project is on a different drive
letter from current working directory.