Merge pull request #2526 from dlang/add_path_workflow
Fix add-path based development workflow
commit 2c8e75b3a852833195b83c5a02dbaef854883205
2 parents fd04494 + 17d0987
@Mathias LANG Mathias LANG authored on 7 Nov 2022
GitHub committed on 7 Nov 2022
Showing 3 changed files
View
10
build.d
immutable VersionFilePath = RootPath.buildPath("source", "dub", "version_.d");
/// Path to the file containing the files to be built
immutable SourceListPath = RootPath.buildPath("build-files.txt");
/// Path at which the newly built `dub` binary will be
immutable DubBinPath = RootPath.buildPath("bin", "dub");
version (Windows) {
immutable DubBinPath = RootPath.buildPath("bin", "dub.exe");
} else {
immutable DubBinPath = RootPath.buildPath("bin", "dub");
}
 
// Flags for DMD
immutable OutputFlag = "-of" ~ DubBinPath;
immutable IncludeFlag = "-I" ~ RootPath.buildPath("source");
View
23
source/dub/packagemanager.d
* Returns:
* A `Package` if one was found, `null` if none exists.
*/
private Package lookup (string name, Version vers) {
if (auto pkg = this.m_internal.lookup(name, vers))
if (!this.m_initialized)
this.refresh();
 
if (auto pkg = this.m_internal.lookup(name, vers, this))
return pkg;
 
foreach (ref location; this.m_repositories)
if (auto p = location.load(name, vers, this))
/** Determines if a package is managed by DUB.
 
Managed packages can be upgraded and removed.
*/
bool isManagedPackage(Package pack)
bool isManagedPackage(const(Package) pack)
const {
auto ppath = pack.basePackage.path;
return isManagedPath(ppath);
}
*
* Returns:
* A `Package` if one was found, `null` if none exists.
*/
private inout(Package) lookup(string name, Version ver) inout {
private inout(Package) lookup(string name, Version ver, PackageManager mgr) inout {
foreach (pkg; this.localPackages)
if (pkg.name == name && pkg.version_.matches(ver, VersionMatchMode.strict))
if (pkg.name == name && pkg.version_.matches(ver, VersionMatchMode.standard))
return pkg;
foreach (pkg; this.fromPath)
if (pkg.name == name && pkg.version_.matches(ver, VersionMatchMode.strict))
foreach (pkg; this.fromPath) {
auto pvm = mgr.isManagedPackage(pkg) ? VersionMatchMode.strict : VersionMatchMode.standard;
if (pkg.name == name && pkg.version_.matches(ver, pvm))
return pkg;
}
return null;
}
 
/**
* A `Package` if one was found, `null` if none exists.
*/
private Package load (string name, Version vers, PackageManager mgr)
{
if (auto pkg = this.lookup(name, vers))
if (auto pkg = this.lookup(name, vers, mgr))
return pkg;
 
string versStr = vers.toString();
const lookupName = getBasePackageName(name);
View
test/prefer-add-path-packages.sh 0 → 100755