diff --git a/source/dub/dub.d b/source/dub/dub.d index 2ebc60a..e1406c8 100644 --- a/source/dub/dub.d +++ b/source/dub/dub.d @@ -33,7 +33,7 @@ import std.encoding : sanitize; // Set output path and options for coverage reports -version (DigitalMars) version (D_Coverage) static if (__VERSION__ >= 2068) +version (DigitalMars) version (D_Coverage) { shared static this() { diff --git a/source/dub/generators/generator.d b/source/dub/generators/generator.d index dca03da..48e10ec 100644 --- a/source/dub/generators/generator.d +++ b/source/dub/generators/generator.d @@ -305,10 +305,7 @@ } collectDependencies(rootPackage, *roottarget, targets); - static if (__VERSION__ > 2070) - visited.clear(); - else - destroy(visited); + visited.clear(); // 1. downwards inherits versions, debugVersions, and inheritable build settings static void configureDependencies(in ref TargetInfo ti, TargetInfo[string] targets, size_t level = 0) @@ -360,10 +357,7 @@ } configureDependents(*roottarget, targets); - static if (__VERSION__ > 2070) - visited.clear(); - else - destroy(visited); + visited.clear(); // 4. Filter applicable version and debug version identifiers if (genSettings.filterVersions) diff --git a/source/dub/internal/utils.d b/source/dub/internal/utils.d index 3c8a6e3..043812d 100644 --- a/source/dub/internal/utils.d +++ b/source/dub/internal/utils.d @@ -26,7 +26,7 @@ version(DubUseCurl) { import std.net.curl; - static if (__VERSION__ > 2075) public import std.net.curl : HTTPStatusException; + public import std.net.curl : HTTPStatusException; } @@ -220,37 +220,8 @@ } } -version(DubUseCurl) { - /++ - Exception thrown on HTTP request failures, e.g. 404 Not Found. - +/ - static if (__VERSION__ <= 2075) class HTTPStatusException : CurlException - { - /++ - Params: - status = The HTTP status code. - msg = The message for the exception. - file = The file where the exception occurred. - line = The line number where the exception occurred. - next = The previous exception in the chain of exceptions, if any. - +/ - @safe pure nothrow - this( - int status, - string msg, - string file = __FILE__, - size_t line = __LINE__, - Throwable next = null) - { - this.status = status; - super(msg, file, line, next); - } - - int status; /// The HTTP status code - } -} else version (Have_vibe_d_http) { +version (Have_vibe_d_http) public import vibe.http.common : HTTPStatusException; -} /** Downloads a file from the specified URL. @@ -271,27 +242,13 @@ auto conn = HTTP(); setupHTTPClient(conn, timeout); logDebug("Storing %s...", url); - static if (__VERSION__ <= 2075) - { - try - std.net.curl.download(url, filename, conn); - catch (CurlException e) - { - if (e.msg.canFind("404")) - throw new HTTPStatusException(404, e.msg); - throw e; - } - } - else - { - std.net.curl.download(url, filename, conn); - // workaround https://issues.dlang.org/show_bug.cgi?id=18318 - auto sl = conn.statusLine; - logDebug("Download %s %s", url, sl); - if (sl.code / 100 != 2) - throw new HTTPStatusException(sl.code, - "Downloading %s failed with %d (%s).".format(url, sl.code, sl.reason)); - } + std.net.curl.download(url, filename, conn); + // workaround https://issues.dlang.org/show_bug.cgi?id=18318 + auto sl = conn.statusLine; + logDebug("Download %s %s", url, sl); + if (sl.code / 100 != 2) + throw new HTTPStatusException(sl.code, + "Downloading %s failed with %d (%s).".format(url, sl.code, sl.reason)); } else version (Have_vibe_d_http) { import vibe.inet.urltransfer; vibe.inet.urltransfer.download(url, filename); @@ -309,19 +266,7 @@ auto conn = HTTP(); setupHTTPClient(conn, timeout); logDebug("Getting %s...", url); - static if (__VERSION__ <= 2075) - { - try - return cast(ubyte[])get(url, conn); - catch (CurlException e) - { - if (e.msg.canFind("404")) - throw new HTTPStatusException(404, e.msg); - throw e; - } - } - else - return cast(ubyte[])get(url, conn); + return cast(ubyte[])get(url, conn); } else version (Have_vibe_d_http) { import vibe.inet.urltransfer; import vibe.stream.operations;