Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate PackageManager.refresh(true), only expose refresh() #2498

Merged
merged 1 commit into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions source/dub/packagemanager.d
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class PackageManager {
this(NativePath path)
{
this.m_internal.searchPath = [ path ];
this.refresh(true);
this.refresh();
}

this(NativePath package_path, NativePath user_path, NativePath system_path, bool refresh_packages = true)
Expand All @@ -108,7 +108,7 @@ class PackageManager {
Location(user_path ~ "packages/"),
Location(system_path ~ "packages/")];

if (refresh_packages) refresh(true);
if (refresh_packages) refresh();
}

/** Gets/sets the list of paths to search for local packages.
Expand All @@ -117,7 +117,7 @@ class PackageManager {
{
if (paths == this.m_internal.searchPath) return;
this.m_internal.searchPath = paths.dup;
refresh(false);
this.refresh();
}
/// ditto
@property const(NativePath)[] searchPath() const { return this.m_internal.searchPath; }
Expand Down Expand Up @@ -152,7 +152,7 @@ class PackageManager {
m_repositories.length = PlacementLocation.max+1;
m_repositories ~= custom_cache_paths.map!(p => Location(p)).array;

refresh(false);
this.refresh();
}


Expand Down Expand Up @@ -624,7 +624,7 @@ class PackageManager {
import core.time : seconds;
auto lock = lockFile(dstpath.toNativeString() ~ ".lock", 30.seconds);
if (dstpath.existsFile()) {
this.refresh(false);
this.refresh();
return this.getPackage(name, vers, dest);
}
return this.store_(src, dstpath, name, vers);
Expand Down Expand Up @@ -849,9 +849,23 @@ symlink_exit:
this.m_repositories[type].writeLocalPackageList();
}

deprecated("Use `refresh()` without boolean argument(same as `refresh(false)`")
void refresh(bool refresh)
{
logDiagnostic("Refreshing local packages (refresh existing: %s)...", refresh);
if (refresh)
logDiagnostic("Refreshing local packages (refresh existing: true)...");
this.refresh_(refresh);
}

void refresh()
{
this.refresh_(false);
}

private void refresh_(bool refresh)
{
if (!refresh)
logDiagnostic("Scanning local packages...");

foreach (ref repository; this.m_repositories)
repository.scanLocalPackages(refresh, this);
Expand Down
2 changes: 1 addition & 1 deletion source/dub/project.d
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ shared static this() {
{
m_dependencies = null;
m_missingDependencies = [];
m_packageManager.refresh(false);
m_packageManager.refresh();

Package resolveSubPackage(Package p, string subname, bool silentFail) {
return subname.length ? m_packageManager.getSubPackage(p, subname, silentFail) : p;
Expand Down