mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 21:21:48 +03:00
Workaround for incorrect working directory for Dub
When DMD is used as a Dub dependency and generates the DMD version as a pre generate command. Dub will execute this command in the current working directory, which usually is the root package working directory, instead of the DMD package directory. This will result in the wrong version, that is, it will pick up the git tag of the root package instead of the DMD package. This looks related: https://github.com/dlang/dub/pull/659.
This commit is contained in:
parent
7fb239d962
commit
ead88f3eb2
1 changed files with 3 additions and 1 deletions
4
config.d
4
config.d
|
@ -50,9 +50,11 @@ string generateVersion(const string versionFile)
|
|||
{
|
||||
import std.process : execute;
|
||||
import std.file : readText;
|
||||
import std.path : dirName;
|
||||
import std.string : strip;
|
||||
|
||||
const result = execute(["git", "describe", "--dirty"]);
|
||||
enum workDir = __FILE_FULL_PATH__.dirName;
|
||||
const result = execute(["git", "-C", workDir, "describe", "--dirty"]);
|
||||
|
||||
return result.status == 0 ? result.output.strip : versionFile.readText;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue