Skip to content

Commit

Permalink
fix #1556: dub --cache=local fetch + build
Browse files Browse the repository at this point in the history
Building a package that was locally cached failed, because
the dependencies whould be fetched at the wrong destination.

For example if one tries to build the package 'optional':

$ dub --cache=local fetch optional
-> optional is now at ./.dub/package/optional
$ dub --cache=local build optional
-> fails because the dependency bolts was fetched to
./.dub/package/optional/.dub/package/bolts.

This is fixed by not overwriting the root path if dub builds
a package from the cache.
  • Loading branch information
Panke authored and Geod24 committed Mar 15, 2020
1 parent 6e9623d commit bcd9048
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
1 change: 0 additions & 1 deletion source/dub/commandline.d
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,6 @@ abstract class PackageBuildCommand : Command {
auto pack = dub.packageManager.getFirstPackage(package_name);
enforce(pack, "Failed to find a package named '"~package_name~"' locally.");
logInfo("Building package %s in %s", pack.name, pack.path.toNativeString());
dub.rootPath = pack.path;
dub.loadPackage(pack);
return true;
}
Expand Down
Empty file.
Binary file not shown.
Binary file not shown.
15 changes: 15 additions & 0 deletions test/issue1556-fetch-and-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
DIR=$(dirname "${BASH_SOURCE[0]}")

. "$DIR"/common.sh

dub remove main-package --non-interactive --version=* 2>/dev/null || true
dub remove dependency-package --non-interactive --version=* 2>/dev/null || true


echo "Trying to fetch fs-sdl-dubpackage"
"$DUB" --cache=local fetch main-package --skip-registry=all --registry=file://"$DIR"/issue1556-fetch-and-build-pkgs

echo "Trying to build it (should fetch dependency-package)"
"$DUB" --cache=local build main-package --skip-registry=all --registry=file://"$DIR"/issue1556-fetch-and-build-pkgs

0 comments on commit bcd9048

Please sign in to comment.