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

[v1.40.0] Remove code deprecated in v1.30.0 #2924

Draft
wants to merge 27 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
fc1711a
Remove deprecated override system
Geod24 Jun 3, 2024
63fe80d
Remove deprecated PackageManager.getLatestPackage
Geod24 Jun 5, 2024
2074d61
Remove Dependency : Repository related deprecations
Geod24 Jun 5, 2024
65ba191
Remove deprecated SelectedVersions Json constructor
Geod24 Jun 5, 2024
c85a46a
Remove deprecated PackageManager.loadSCMPackage(string, Dependency)
Geod24 Jun 5, 2024
8cf5ffe
Remove deprecated Project.dependencyToJson
Geod24 Jun 5, 2024
e2fdbda
Remove deprecated Dub.remove(pack, bool)
Geod24 Jun 5, 2024
0cd0675
Remove deprecation project : PlacementLocation alias
Geod24 Jun 5, 2024
189d4f5
Remove deprecated selections JSON deserialization functions
Geod24 Jun 5, 2024
8898c1c
Remove deprecated DependencyResolver constructor
Geod24 Jun 5, 2024
2a81349
Error our on invalid settings / selections file
Geod24 Jun 5, 2024
2a0b04c
Remove deprecated enum LocalPackageType
Geod24 Jun 5, 2024
e0e7209
Remove deprecated Dependency.matchesAny
Geod24 Jun 5, 2024
6b8726d
Remove deprecated dub.remove overload
Geod24 Jun 5, 2024
d9c2355
Remove deprecated Dependency.versionSpec
Geod24 Jun 5, 2024
fd7830d
Remove deprecated Dub.fetch with Dependency
Geod24 Jun 5, 2024
d64cc26
Remove deprecated Dub.getPackageSuppliers
Geod24 Jun 5, 2024
0db33e3
Remove deprecated PackageManaget.getPackage version string overloads
Geod24 Jun 5, 2024
855cd2d
Remove deprecated Dependency.path and repository setters
Geod24 Jun 5, 2024
a645511
Error out on invalid dub.json file
Geod24 Jun 5, 2024
b82ec23
Remove deprecated PackageManager.getFirstPackage
Geod24 Jun 5, 2024
0248cbb
Remove deprecated PackageManager.getPackage(string, NativePath)
Geod24 Jun 5, 2024
0ca27a9
Remove PackageManager.completeSearchPath
Geod24 Jun 5, 2024
9cd7640
Remove deprecated PackageManager.getPackage overload
Geod24 Jun 5, 2024
3558335
Remove deprecated PackageManager.storeFetchedPackage
Geod24 Jun 5, 2024
6d4fb1a
Dub: Remove the ability to change the rootpath
Geod24 Jun 5, 2024
6e5e4c9
Remove deprecated BuildOptions / BuildRequirements aliases
Geod24 Jun 5, 2024
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
9 changes: 9 additions & 0 deletions changelog/removed_overrides.dd
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The override system has been removed

The override system was deprecated in v1.30.0 as it was neither
widely used nor generally useful given Dub's available feature set.
With this release, it is now completely removed.

This means that the commands `add-override`, `remove-override`,
`list-override`, and the interaction with `local-overrides.json`
have been removed, along with all the associated APIs.
122 changes: 1 addition & 121 deletions source/dub/commandline.d
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ CommandGroup[] getCommands() @safe pure nothrow
new RemoveLocalCommand,
new ListCommand,
new SearchCommand,
new AddOverrideCommand,
new RemoveOverrideCommand,
new ListOverridesCommand,
new CleanCachesCommand,
new ConvertCommand,
)
Expand Down Expand Up @@ -272,7 +269,7 @@ unittest {
assert(handler.commandNames == ["init", "run", "build", "test", "lint", "generate",
"describe", "clean", "dustmite", "fetch", "add", "remove",
"upgrade", "add-path", "remove-path", "add-local", "remove-local", "list", "search",
"add-override", "remove-override", "list-overrides", "clean-caches", "convert"]);
"clean-caches", "convert"]);
}

/// It sets the cwd as root_path by default
Expand Down Expand Up @@ -2561,123 +2558,6 @@ class SearchCommand : Command {
}
}


/******************************************************************************/
/* OVERRIDES */
/******************************************************************************/

class AddOverrideCommand : Command {
private {
bool m_system = false;
}

static immutable string DeprecationMessage =
"This command is deprecated. Use path based dependency, custom cache path, " ~
"or edit `dub.selections.json` to achieve the same results.";


this() @safe pure nothrow
{
this.name = "add-override";
this.argumentsPattern = "<package> <version-spec> <target-path/target-version>";
this.description = "Adds a new package override.";

this.hidden = true;
this.helpText = [ DeprecationMessage ];
}

override void prepare(scope CommandArgs args)
{
args.getopt("system", &m_system, [
"Register system-wide instead of user-wide"
]);
}

override int execute(Dub dub, string[] free_args, string[] app_args)
{
logWarn(DeprecationMessage);
enforceUsage(app_args.length == 0, "Unexpected application arguments.");
enforceUsage(free_args.length == 3, "Expected three arguments, not "~free_args.length.to!string);
auto scope_ = m_system ? PlacementLocation.system : PlacementLocation.user;
auto pack = free_args[0];
auto source = VersionRange.fromString(free_args[1]);
if (existsFile(NativePath(free_args[2]))) {
auto target = NativePath(free_args[2]);
if (!target.absolute) target = getWorkingDirectory() ~ target;
dub.packageManager.addOverride_(scope_, pack, source, target);
logInfo("Added override %s %s => %s", pack, source, target);
} else {
auto target = Version(free_args[2]);
dub.packageManager.addOverride_(scope_, pack, source, target);
logInfo("Added override %s %s => %s", pack, source, target);
}
return 0;
}
}

class RemoveOverrideCommand : Command {
private {
bool m_system = false;
}

this() @safe pure nothrow
{
this.name = "remove-override";
this.argumentsPattern = "<package> <version-spec>";
this.description = "Removes an existing package override.";

this.hidden = true;
this.helpText = [ AddOverrideCommand.DeprecationMessage ];
}

override void prepare(scope CommandArgs args)
{
args.getopt("system", &m_system, [
"Register system-wide instead of user-wide"
]);
}

override int execute(Dub dub, string[] free_args, string[] app_args)
{
logWarn(AddOverrideCommand.DeprecationMessage);
enforceUsage(app_args.length == 0, "Unexpected application arguments.");
enforceUsage(free_args.length == 2, "Expected two arguments, not "~free_args.length.to!string);
auto scope_ = m_system ? PlacementLocation.system : PlacementLocation.user;
auto source = VersionRange.fromString(free_args[1]);
dub.packageManager.removeOverride_(scope_, free_args[0], source);
return 0;
}
}

class ListOverridesCommand : Command {
this() @safe pure nothrow
{
this.name = "list-overrides";
this.argumentsPattern = "";
this.description = "Prints a list of all local package overrides";

this.hidden = true;
this.helpText = [ AddOverrideCommand.DeprecationMessage ];
}
override void prepare(scope CommandArgs args) {}
override int execute(Dub dub, string[] free_args, string[] app_args)
{
logWarn(AddOverrideCommand.DeprecationMessage);

void printList(in PackageOverride_[] overrides, string caption)
{
if (overrides.length == 0) return;
logInfoNoTag("# %s", caption);
foreach (ovr; overrides)
ovr.target.match!(
t => logInfoNoTag("%s %s => %s", ovr.package_.color(Mode.bold), ovr.source, t));
}
printList(dub.packageManager.getOverrides_(PlacementLocation.user), "User wide overrides");
printList(dub.packageManager.getOverrides_(PlacementLocation.system), "System wide overrides");
return 0;
}
}

/******************************************************************************/
/* Cache cleanup */
/******************************************************************************/
Expand Down
6 changes: 0 additions & 6 deletions source/dub/compilers/buildsettings.d
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,3 @@ enum Flags!BuildOption inheritedBuildOptions =
| BuildOption.ignoreDeprecations | BuildOption.deprecationWarnings
| BuildOption.deprecationErrors | BuildOption.property | BuildOption.profileGC
| BuildOption.pic;

deprecated("Use `Flags!BuildOption` instead")
public alias BuildOptions = Flags!BuildOption;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the value of deprecating/removing something like this? IMO, it makes code easier to read and also keeps a door open for backwards compatible adjustments of the exact type (exactly like what was happening in the mentioned original commit).


deprecated("Use `Flags!BuildRequirement` instead")
public alias BuildRequirements = Flags!BuildRequirement;
67 changes: 3 additions & 64 deletions source/dub/dependency.d
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ struct Dependency {

/** Constructs a new dependency specification from a string

See the `versionSpec` property for a description of the accepted
See the `VersionRange` type for a description of the accepted
contents of that string.
*/
this(string spec) @safe
Expand All @@ -188,21 +188,7 @@ struct Dependency {
this.m_value = rng;
}

deprecated("Instantiate the `Repository` struct with the string directly")
this(Repository repository, string spec) @safe
{
assert(repository.m_ref is null);
repository.m_ref = spec;
this(repository);
}

/// If set, overrides any version based dependency selection.
deprecated("Construct a new `Dependency` object instead")
@property void path(NativePath value) @trusted
{
this.m_value = value;
}
/// ditto
/// The path this `Dependency` matches, or `NativePath.init`
@property NativePath path() const @safe
{
return this.m_value.match!(
Expand All @@ -211,13 +197,7 @@ struct Dependency {
);
}

/// If set, overrides any version based dependency selection.
deprecated("Construct a new `Dependency` object instead")
@property void repository(Repository value) @trusted
{
this.m_value = value;
}
/// ditto
/// The repository this `Dependency` matches, or `Repository.init`
@property Repository repository() const @safe
{
return this.m_value.match!(
Expand Down Expand Up @@ -271,23 +251,6 @@ struct Dependency {
return range.m_versA;
}

/// Sets/gets the matching version range as a specification string.
deprecated("Create a new `Dependency` instead and provide a `VersionRange`")
@property void versionSpec(string ves) @trusted
{
this.m_value = VersionRange.fromString(ves);
}

/// ditto
deprecated("Use `Dependency.visit` and match `VersionRange`instead")
@property string versionSpec() const @safe {
return this.m_value.match!(
(const NativePath p) => ANY_IDENT,
(const Repository r) => r.m_ref,
(const VersionRange p) => p.toString(),
);
}

/** Returns a modified dependency that gets mapped to a given path.

This function will return an unmodified `Dependency` if it is not path
Expand Down Expand Up @@ -485,19 +448,6 @@ struct Dependency {
);
}

/** Determines if this dependency specification matches arbitrary versions.

This is true in particular for the `any` constant.
*/
deprecated("Use `VersionRange.matchesAny` directly")
bool matchesAny() const scope @safe {
return this.m_value.match!(
(NativePath v) => true,
(Repository v) => true,
(VersionRange v) => v.matchesAny(),
);
}

/** Tests if the specification matches a specific version.
*/
bool matches(string vers, VersionMatchMode mode = VersionMatchMode.standard) const @safe
Expand Down Expand Up @@ -767,17 +717,6 @@ struct Repository
assert(m_ref.length);
}

/// Ditto
deprecated("Use the constructor accepting a second parameter named `ref_`")
this(string remote)
{
enforce(remote.startsWith("git+"), "Unsupported repository type (supports: git+URL)");

m_remote = remote["git+".length .. $];
m_kind = Kind.git;
assert(m_remote.length);
}

string toString() const nothrow pure @safe
{
if (empty) return null;
Expand Down
12 changes: 0 additions & 12 deletions source/dub/dependencyresolver.d
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,6 @@ class DependencyResolver(CONFIGS, CONFIG) {
this.loop_limit = limit;
}

/// Compatibility overload
deprecated("Use the overload that accepts a `ulong limit` argument")
public this () scope @safe
{
// Leave the possibility to opt-out from the loop limit
import std.process : environment;
if (environment.get("DUB_NO_RESOLVE_LIMIT") !is null)
this(ulong.max);
else
this(1_000_000);
}

/** Encapsulates a list of outgoing edges in the dependency graph.

A value of this type represents a single dependency with multiple
Expand Down
Loading
Loading