Skip to content

Commit

Permalink
fix dlang#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 committed Mar 11, 2020
1 parent ae65ee7 commit c724cbb
Show file tree
Hide file tree
Showing 2 changed files with 9 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
9 changes: 9 additions & 0 deletions test/issue1556.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

. $(dirname "${BASH_SOURCE[0]}")/common.sh

${DUB} --cache=local remove optional || true
${DUB} --cache=local remove bolts || true
${DUB} --cache=local fetch optional
${DUB} --cache=local build optional --compiler=${DC}

0 comments on commit c724cbb

Please sign in to comment.