Skip to content
Create a simple package version for your d projects.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
source
.gitignore
.travis.yml
LICENSE
dub.sdl
dub.selections.json
readme.org

readme.org

packageversion

https://img.shields.io/github/tag/gizmomogwai/packageversion.svg?style=flat-square https://img.shields.io/travis/gizmomogwai/packageversion/master.svg?style=flat-square https://img.shields.io/codecov/c/github/gizmomogwai/packageversion/master.svg?style=flat-square https://img.shields.io/readthedocs/pip.svg?style=flat-square

Packageversion is a simple tool to generate or update version information for a dub package. It uses several mechanisms to find this version:

  1. look into DUB_PACKAGE_DIR dub.json
  2. look into DUB_PACKAGE_DIR dub.sdl
  3. use git describe in DUB_PACKAGE_DIR

Because of this strategies its possible to generate also version numbers in builds of dependencies of a dub project.

The generated modules register the package (with its version) to the packageversion api, that then can be used to print the projects (and its dependencies versions).

Prior art

In contrast to gen-package-version the version is not time dependent which makes builds more reproducible.

Todos

Change api to use a real package version struct that includes name, version, license, …

Best practice for libraries that want to provide a packageversion

If your are a library, that wants to provide packageversion information:

  • add packageversion dependency:
dependency "packageversion" version="~>0.0.15"
subConfiguration "packageversion" "library"
  • add a call to packageversion’s api in a static packageversion module:
module ponies.packageversion;
const VERSION = "v0.0.3-24-g1bdc8d6-dirty";
const NAME = "ponies";
const LICENSE = "MIT";
static this()
{
    import packageversion;
    packageversion.registerPackageVersion(NAME, VERSION, LICENSE);
}
  • public import your packageversion module so that client of your library link against it automatically.
You can’t perform that action at this time.