diff --git a/README.md b/README.md index 030cf7a..8c2e953 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,11 @@ Daniel Jost maintains a dub package on [chocolatey](https://chocolatey.org/packages/dub). Use `cinst dub` or `cinst dub -version #.#.#` to install stable or a custom version respectively. +## Alpine Linux + +Mathias (@Geod24) Lang maintains the Alpine Linux packages. +It is currently part of 'edge' and can be installed through `apk --no-cache add -X http://dl-cdn.alpinelinux.org/alpine/edge/testing dub`. + ## Using DUB as a library The [DUB package of DUB](http://code.dlang.org/packages/dub) can be used as a library to load or manipulate packages, or to resemble any functionality of the command line tool. The former task can be achieved by using the [Package class](https://github.com/dlang/dub/blob/master/source/dub/package_.d#L40). For examples on how to replicate the command line functionality, see [commandline.d](https://github.com/dlang/dub/blob/master/source/dub/commandline.d). diff --git a/source/dub/dependency.d b/source/dub/dependency.d index da551b5..f16edcc 100644 --- a/source/dub/dependency.d +++ b/source/dub/dependency.d @@ -143,7 +143,6 @@ static import std.string; enforce(ves.length > 0); - string orig = ves; if (ves == ANY_IDENT) { // Any version is good. diff --git a/source/dub/dub.d b/source/dub/dub.d index 3f0d9ca..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() { @@ -59,7 +59,7 @@ deprecated("use defaultRegistryURLs") enum defaultRegistryURL = defaultRegistryURLs[0]; /// The URL to the official package registry and it's default fallback registries. -enum defaultRegistryURLs = [ +static immutable string[] defaultRegistryURLs = [ "https://code.dlang.org/", "https://code-mirror.dlang.io/", "https://dub-registry.herokuapp.com/", @@ -1201,7 +1201,6 @@ enforce(!vers.empty, "Failed to find any valid versions for a package name of '"~package_name~"'."); auto final_versions = vers.filter!(v => !v.isBranch && !v.isPreRelease).array; if (prefer_stable && final_versions.length) return final_versions[$-1]; - else if (vers[$-1].isBranch) return vers[$-1]; else return vers[$-1]; } diff --git a/source/dub/generators/build.d b/source/dub/generators/build.d index 88722d2..5a92dbf 100644 --- a/source/dub/generators/build.d +++ b/source/dub/generators/build.d @@ -48,8 +48,6 @@ { scope (exit) cleanupTemporaries(); - auto dcl = settings.compiler; - void checkPkgRequirements(const(Package) pkg) { const tr = pkg.recipe.toolchainRequirements; @@ -86,7 +84,6 @@ NativePath[] additional_dep_files; auto bs = ti.buildSettings.dup; foreach (ldep; ti.linkDependencies) { - auto dbs = targets[ldep].buildSettings; if (bs.targetType != TargetType.staticLibrary && !(bs.options & BuildOption.syntaxOnly)) { bs.addSourceFiles(target_paths[ldep].toNativeString()); } else { @@ -194,9 +191,6 @@ return false; } - // determine basic build properties - auto generate_binary = !(buildsettings.options & BuildOption.syntaxOnly); - logInfo("%s %s: building configuration \"%s\"...", pack.name, pack.version_, config); if( buildsettings.preBuildCommands.length ){ @@ -284,9 +278,7 @@ private void performDirectBuild(GeneratorSettings settings, ref BuildSettings buildsettings, in Package pack, string config, out NativePath target_path) { auto cwd = NativePath(getcwd()); - auto generate_binary = !(buildsettings.options & BuildOption.syntaxOnly); - auto is_static_library = buildsettings.targetType == TargetType.staticLibrary || buildsettings.targetType == TargetType.library; // make file paths relative to shrink the command line foreach (ref f; buildsettings.sourceFiles) { @@ -450,7 +442,6 @@ auto generate_binary = !(buildsettings.options & BuildOption.syntaxOnly); auto is_static_library = buildsettings.targetType == TargetType.staticLibrary || buildsettings.targetType == TargetType.library; - NativePath target_file; scope (failure) { logDiagnostic("FAIL %s %s %s" , buildsettings.targetPath, buildsettings.targetName, buildsettings.targetType); auto tpath = getTargetPath(buildsettings, settings); @@ -644,8 +635,6 @@ } } - auto comp = new TestCompiler; - GeneratorSettings settings; settings.platform = BuildPlatform(determinePlatform(), ["x86"], "gdc", "test", 2075); settings.compiler = new TestCompiler; 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/generators/sublimetext.d b/source/dub/generators/sublimetext.d index 9ac53c9..1bf2187 100644 --- a/source/dub/generators/sublimetext.d +++ b/source/dub/generators/sublimetext.d @@ -67,7 +67,7 @@ private Json buildSystems(BuildPlatform buildPlatform, string workingDiretory = getcwd()) { - enum BUILD_TYPES = [ + static immutable BUILD_TYPES = [ //"plain", "debug", "release", diff --git a/source/dub/generators/visuald.d b/source/dub/generators/visuald.d index aa8bc59..13ab9a3 100644 --- a/source/dub/generators/visuald.d +++ b/source/dub/generators/visuald.d @@ -104,7 +104,6 @@ const string[] sub = ["ActiveCfg", "Build.0"]; const string[] conf = [settings.buildType~"|"~settings.platform.architecture[0].vsArchitecture]; - auto projectUuid = guid(mainpack); foreach (t; targets.byKey) foreach (c; conf) foreach (s; sub) @@ -155,7 +154,6 @@ { import dub.compilers.utils : isLinkerFile; - int i = 0; auto ret = appender!(char[])(); auto project_file_dir = m_project.rootPackage.path ~ projFileName(packname).parentPath; diff --git a/source/dub/init.d b/source/dub/init.d index 98c98c4..da068fc 100644 --- a/source/dub/init.d +++ b/source/dub/init.d @@ -145,7 +145,6 @@ { import dub.compilers.buildsettings : TargetType; - auto name = root_path.head.toString().toLower(); p.description = format("Deimos Bindings for "~p.name~"."); p.buildSettings.importPaths[""] ~= "."; p.buildSettings.targetType = TargetType.sourceLibrary; diff --git a/source/dub/internal/utils.d b/source/dub/internal/utils.d index 5879e79..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; } @@ -105,12 +105,6 @@ } } -bool isEmptyDir(NativePath p) { - foreach(DirEntry e; dirEntries(p.toNativeString(), SpanMode.shallow)) - return false; - return true; -} - bool isWritableDir(NativePath p, bool create_if_missing = false) { import std.random; @@ -163,17 +157,6 @@ throw new Exception("No package descriptor found"); } -Json jsonFromZip(NativePath zip, string filename) { - import std.zip : ZipArchive; - auto f = openFile(zip, FileMode.read); - ubyte[] b = new ubyte[cast(size_t)f.size]; - f.rawRead(b); - f.close(); - auto archive = new ZipArchive(b); - auto text = stripUTF8Bom(cast(string)archive.expand(archive.directory[filename])); - return parseJsonString(text, zip.toNativeString~"/"~filename); -} - void writeJsonFile(NativePath path, Json json) { auto f = openFile(path, FileMode.createTrunc); @@ -197,11 +180,6 @@ moveFile(tmppath, path); } -bool isPathFromZip(string p) { - enforce(p.length > 0); - return p[$-1] == '/'; -} - bool existsDirectory(NativePath path) { if( !existsFile(path) ) return false; auto fi = getFileInfo(path); @@ -242,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. @@ -293,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); @@ -331,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; diff --git a/source/dub/internal/vibecompat/data/utils.d b/source/dub/internal/vibecompat/data/utils.d index a967455..ace6a76 100644 --- a/source/dub/internal/vibecompat/data/utils.d +++ b/source/dub/internal/vibecompat/data/utils.d @@ -215,8 +215,8 @@ ref int someTempl()() { return i; } } - enum plainFields = ["i"]; - enum fields = ["i", "p1", "p4", "p5"]; + immutable plainFields = ["i"]; + immutable fields = ["i", "p1", "p4", "p5"]; foreach (mem; __traits(allMembers, S)) { static if (isRWField!(S, mem)) static assert(fields.canFind(mem), mem~" detected as field."); diff --git a/source/dub/internal/vibecompat/inet/path.d b/source/dub/internal/vibecompat/inet/path.d index 4ad987e..c25878a 100644 --- a/source/dub/internal/vibecompat/inet/path.d +++ b/source/dub/internal/vibecompat/inet/path.d @@ -221,7 +221,6 @@ ret.normalize(); // needed to avoid "."~".." become "" instead of ".." assert(!rhs.absolute, "Trying to append absolute path."); - size_t idx = m_nodes.length; foreach(folder; rhs.m_nodes){ switch(folder.toString()){ default: ret.m_nodes = ret.m_nodes ~ folder; break; diff --git a/source/dub/packagemanager.d b/source/dub/packagemanager.d index 13134b5..08a02d0 100644 --- a/source/dub/packagemanager.d +++ b/source/dub/packagemanager.d @@ -362,7 +362,6 @@ auto package_name = package_info["name"].get!string; auto package_version = package_info["version"].get!string; - auto clean_package_version = package_version[package_version.startsWith("~") ? 1 : 0 .. $]; logDebug("Placing package '%s' version '%s' to location '%s' from file '%s'", package_name, package_version, destination.toNativeString(), zip_file_path.toNativeString()); diff --git a/source/dub/recipe/json.d b/source/dub/recipe/json.d index 354a1e6..791d485 100644 --- a/source/dub/recipe/json.d +++ b/source/dub/recipe/json.d @@ -149,8 +149,6 @@ } enforce(!config.name.empty, "Configuration is missing a name."); - - BuildSettingsTemplate bs; config.buildSettings.parseJson(json, package_name); } diff --git a/source/dub/recipe/sdl.d b/source/dub/recipe/sdl.d index d45bd10..7f3ad45 100644 --- a/source/dub/recipe/sdl.d +++ b/source/dub/recipe/sdl.d @@ -182,8 +182,6 @@ Dependency dep = Dependency.any; auto attrs = t.attributes; - auto pv = "version" in attrs; - if ("path" in attrs) { if ("version" in attrs) logDiagnostic("Ignoring version specification (%s) for path based dependency %s", attrs["version"][0].value.get!string, attrs["path"][0].value.get!string);