diff --git a/source/dub/package_.d b/source/dub/package_.d index 7de7401..616d4da 100644 --- a/source/dub/package_.d +++ b/source/dub/package_.d @@ -57,7 +57,7 @@ return false; } - this(Path root, Package parent = null) + this(Path root, Package parent = null, string versionOverride = "") { Json info; try { @@ -73,10 +73,10 @@ enforce(info.type != Json.Type.undefined, format("Missing package description for package at %s", root.toNativeString())); - this(info, root, parent); + this(info, root, parent, versionOverride); } - this(Json packageInfo, Path root = Path(), Package parent = null) + this(Json packageInfo, Path root = Path(), Package parent = null, string versionOverride = "") { m_parentPackage = parent; m_path = root; @@ -113,6 +113,9 @@ scope(failure) logError("Failed to parse package description in %s", root.toNativeString()); m_info.parseJson(packageInfo); + if (!versionOverride.empty) + m_info.version_ = versionOverride; + // try to run git to determine the version of the package if no explicit version was given if (m_info.version_.length == 0 && !parent) { import std.process; diff --git a/source/dub/packagemanager.d b/source/dub/packagemanager.d index 3b07da5..2f1c42c 100644 --- a/source/dub/packagemanager.d +++ b/source/dub/packagemanager.d @@ -270,8 +270,7 @@ logDiagnostic("%s file(s) copied.", to!string(countFiles)); // overwrite package.json (this one includes a version field) - auto pack = new Package(destination); - pack.info.version_ = package_info["version"].get!string; + auto pack = new Package(destination, null, package_info["version"].get!string); if (pack.packageInfoFile.head != defaultPackageFilename()) { // Storeinfo saved a default file, this could be different to the file from the zip.