Thread overview
gen-package-version v1.0.0
Jun 28, 2015
Nick Sabalausky
Jun 28, 2015
Nick Sabalausky
gen-package-version v1.0.2
Jul 01, 2015
Nick Sabalausky
June 28, 2015
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.

June 28, 2015
On 06/28/2015 01:02 AM, Nick Sabalausky wrote:
> Update to gen-package-version:
> https://github.com/Abscissa/gen-package-version
>

gen-package-version v1.0.1:
- Fixed: Don't use a broken scriptlike release (v0.9.0), use v0.9.1 instead.

In your project's dub.json:
------------------
"dependencies": {
     "gen-package-version": "~>1.0.1"
},
"preGenerateCommands":
["dub run gen-package-version -- your.package.name --root=$PACKAGE_DIR
--src=path/to/src"]
------------------

July 01, 2015
gen-package-version v1.0.2:
One small change:
- Now works on DMD 2.066.1 (previously required 2.067.0 or up).

In your project's dub.json:
------------------
"dependencies": {
     "gen-package-version": "~>1.0.2"
},
"preGenerateCommands":
["dub run gen-package-version -- your.package.name --root=$PACKAGE_DIR
--src=path/to/src"]
------------------