Merge pull request from wilzbach/dub-valid-version

Generate a valid version for the DUB build
merged-on-behalf-of: Brian Schott <Hackerpilot@users.noreply.github.com>
This commit is contained in:
The Dlang Bot 2018-04-07 00:43:06 +02:00 committed by GitHub
commit af0bebd891
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -19,5 +19,9 @@
"libddoc" : "~>0.3.0-beta.1", "libddoc" : "~>0.3.0-beta.1",
"stdx-allocator" : "~>2.77.0" "stdx-allocator" : "~>2.77.0"
}, },
"targetPath" : "bin" "targetPath" : "bin",
"stringImportPaths": ["bin"],
"preGenerateCommands": [
"rdmd --eval='auto dir=environment.get(`DUB_PACKAGE_DIR`); dir.buildPath(`bin`).mkdirRecurse; auto gitVer = (`git -C `~dir~` describe --tags`).executeShell; (gitVer.status == 0 ? gitVer.output : dir.dirName.baseName.findSplitAfter(environment.get(`DUB_ROOT_PACKAGE`)~`-`)[1]).ifThrown(`0.0.0`).toFile(dir.buildPath(`bin`, `dubhash.txt`));'",
]
} }

View File

@ -10,10 +10,11 @@ module dscanner.dscanner_version;
*/ */
enum DSCANNER_VERSION = "v0.4.0"; enum DSCANNER_VERSION = "v0.4.0";
version (Windows) version (built_with_dub)
{ {
enum GIT_HASH = import("dubhash.txt");
} }
else version (built_with_dub) else version (Windows)
{ {
} }
else else