Hello community, here is the log from the commit of package dub for openSUSE:Factory checked in at 2019-08-15 12:29:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/dub (Old) and /work/SRC/openSUSE:Factory/.dub.new.9556 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "dub" Thu Aug 15 12:29:02 2019 rev:18 rq:723310 version:1.16.0 Changes: -------- --- /work/SRC/openSUSE:Factory/dub/dub.changes 2019-03-18 10:43:45.403120341 +0100 +++ /work/SRC/openSUSE:Factory/.dub.new.9556/dub.changes 2019-08-15 12:29:04.238510728 +0200 @@ -1,0 +2,6 @@ +Wed Aug 14 13:41:19 UTC 2019 - Matthias Eliasson <[email protected]> + +- Update to version 1.16.0 + * No changelog was made available. + +------------------------------------------------------------------- Old: ---- dub-1.14.0.tar.gz New: ---- dub-1.16.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ dub.spec ++++++ --- /var/tmp/diff_new_pack.PJVPYj/_old 2019-08-15 12:29:05.226509812 +0200 +++ /var/tmp/diff_new_pack.PJVPYj/_new 2019-08-15 12:29:05.230509809 +0200 @@ -23,12 +23,12 @@ %bcond_with dcompiler_dmd %endif Name: dub -Version: 1.14.0 +Version: 1.16.0 Release: 0 Summary: Package manager and meta build tool for the D programming language License: MIT Group: Development/Languages/Other -URL: http://code.dlang.org +URL: https://code.dlang.org Source: https://github.com/dlang/dub/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz BuildRequires: pkgconfig BuildRequires: pkgconfig(libcurl) ++++++ dub-1.14.0.tar.gz -> dub-1.16.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/.github/FUNDING.yml new/dub-1.16.0/.github/FUNDING.yml --- old/dub-1.14.0/.github/FUNDING.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/dub-1.16.0/.github/FUNDING.yml 2019-07-02 11:57:23.000000000 +0200 @@ -0,0 +1,4 @@ +# https://help.github.com/en/articles/displaying-a-sponsor-button-in-your-repository + +open_collective: dlang +custom: https://dlang.org/foundation/donate.html diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/.travis.yml new/dub-1.16.0/.travis.yml --- old/dub-1.14.0/.travis.yml 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/.travis.yml 2019-07-02 11:57:23.000000000 +0200 @@ -21,7 +21,9 @@ - d: gdc include: - stage: test - d: dmd-2.081.1 + d: dmd-2.086.0 + env: [FRONTEND=2.086] + - d: dmd-2.081.1 env: [FRONTEND=2.081] - d: dmd-2.080.1 env: [FRONTEND=2.080] @@ -33,14 +35,6 @@ env: [FRONTEND=2.077, COVERAGE=true] - d: dmd-2.076.1 env: [FRONTEND=2.076] - - d: dmd-2.075.1 - env: [FRONTEND=2.075] - - d: dmd-2.074.1 - env: [FRONTEND=2.074] - - d: dmd-2.073.2 - env: [FRONTEND=2.073] - - d: dmd-2.072.2 - env: [FRONTEND=2.072] - d: ldc-1.10.0 env: [FRONTEND=2.080] - d: ldc-1.9.0 @@ -51,14 +45,8 @@ env: [FRONTEND=2.077] - d: ldc-1.6.0 env: [FRONTEND=2.076] - - d: ldc-1.5.0 - env: [FRONTEND=2.075] - - d: ldc-1.4.0 - env: [FRONTEND=2.074] - - d: ldc-1.3.0 - env: [FRONTEND=2.073] - stage: deploy - d: ldc + d: ldc-1.15.0 os: osx script: echo "Deploying to GitHub releases ..." && ./release.sh deploy: @@ -69,7 +57,7 @@ api_key: $GH_REPO_TOKEN on: tags: true - - d: ldc + - d: ldc-1.15.0 script: echo "Deploying to GitHub releases ..." && ./release.sh env: [ARCH=32] addons: @@ -85,7 +73,7 @@ api_key: $GH_REPO_TOKEN on: tags: true - - d: ldc + - d: ldc-1.15.0 script: echo "Deploying to GitHub releases ..." && ./release.sh deploy: - provider: releases @@ -95,7 +83,7 @@ api_key: $GH_REPO_TOKEN on: tags: true - - d: ldc + - d: ldc-1.15.0 script: echo "Deploying to GitHub releases (win32) ..." && ./release-windows.sh addons: apt: @@ -109,7 +97,7 @@ api_key: $GH_REPO_TOKEN on: tags: true - - d: ldc + - d: ldc-1.15.0 script: echo "Deploying to GitHub releases (win64) ..." && ARCH=64 ./release-windows.sh addons: apt: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/README.md new/dub-1.16.0/README.md --- old/dub-1.14.0/README.md 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/README.md 2019-07-02 11:57:23.000000000 +0200 @@ -60,7 +60,7 @@ ## Minimal D compiler required to build DUB In general it is always recommended to build DUB with the latest version of your D compiler. -However, currently [2.072](https://dlang.org/changelog/2.072.0.html) is required to build DUB from source. +However, currently [2.076](https://dlang.org/changelog/2.076.0.html) is required to build DUB from source. # Contributing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/appveyor.yml new/dub-1.16.0/appveyor.yml --- old/dub-1.14.0/appveyor.yml 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/appveyor.yml 2019-07-02 11:57:23.000000000 +0200 @@ -17,10 +17,10 @@ DVersion: stable arch: x64 - DC: dmd - DVersion: 2.072.2 + DVersion: 2.086.0 arch: x86 - DC: dmd - DVersion: 2.072.2 + DVersion: 2.086.0 arch: x64 - DC: dmd DVersion: stable @@ -29,7 +29,7 @@ DVersion: stable arch: x64 - DC: ldc - DVersion: 1.7.0 + DVersion: 1.15.0 arch: x64 skip_tags: false diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/changelog/dub-fetch-shortcut.dd new/dub-1.16.0/changelog/dub-fetch-shortcut.dd --- old/dub-1.14.0/changelog/dub-fetch-shortcut.dd 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/changelog/dub-fetch-shortcut.dd 1970-01-01 01:00:00.000000000 +0100 @@ -1,9 +0,0 @@ -`dub fetch` now supports `<package>@<version>` as a shortcut - -`dub fetch <package>@<version>` is a shortcut for -`dub fetch <package> --version=<version>`: - -$(CONSOLE -> dub fetch [email protected] -Fetching gitcompatibledubpackage 1.0.4... -) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/changelog/extraDependencyFiles-attribute-added.dd new/dub-1.16.0/changelog/extraDependencyFiles-attribute-added.dd --- old/dub-1.14.0/changelog/extraDependencyFiles-attribute-added.dd 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/changelog/extraDependencyFiles-attribute-added.dd 1970-01-01 01:00:00.000000000 +0100 @@ -1,4 +0,0 @@ -extraDependencyFiles attribute added - -Using attribute `extraDependencyFiles` a list of files can be specified -causing rebuild on change. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/changelog/file-system-supplier.dd new/dub-1.16.0/changelog/file-system-supplier.dd --- old/dub-1.14.0/changelog/file-system-supplier.dd 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/changelog/file-system-supplier.dd 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +0,0 @@ -File system supplier enabled - -Existing file system supplier is enabled for usage. -It searches a certain directory for files with names of -the form "[package name]-[version].zip". - -Example `dub fetch mypackage --registry=file:///etc/dub/packages/` \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/changelog/toolchain_requirements.dd new/dub-1.16.0/changelog/toolchain_requirements.dd --- old/dub-1.14.0/changelog/toolchain_requirements.dd 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/changelog/toolchain_requirements.dd 1970-01-01 01:00:00.000000000 +0100 @@ -1,54 +0,0 @@ -`toolchainRequirements` recipe entry - -DUB now supports a new entry in `dub.json` or `dub.sdl` to restrict the versions of -DUB and of compilers supported by a package. - -dub.json: ---- -{ - "toolchainRequirements": { - "dub": "~>1.10", - "frontend": ">=2.068 <2.083" - } -} ---- - -dub.sdl: ---- -toolchainRequirements dub="~>1.10" frontend=">=2.068|<2.083" ---- - -Supported entries in `toolchainRequirements` are: -$(UL - $(LI dub) - $(LI frontend) - $(LI dmd) - $(LI ldc) - $(LI gdc) -) - -Each can contain a -$(LINK2 https://dub.pm/package-format-sdl.html#version-specs, version specification), -where DMD-like versions are supported in addition to SemVer versions. For -compilers, instead of a version specification, the keyword `no` can also be used -to indicate that the compiler should not be used for this package. - -Example scenario:$(BR) -Package that needs DUB>=1.12, and that will only build with LDC>=1.10: - -dub.json: ---- -{ - "toolchainRequirements": { - "dub": ">=1.12", - "dmd": "no", - "gdc": "no", - "ldc": ">=1.10" - } -} ---- - -dub.sdl: ---- -toolchainRequirements dub=">=1.12" dmd="no" gdc="no" ldc=">=1.10" ---- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/dub.selections.json new/dub-1.16.0/dub.selections.json --- old/dub-1.14.0/dub.selections.json 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/dub.selections.json 2019-07-02 11:57:23.000000000 +0200 @@ -1,18 +1,19 @@ { "fileVersion": 1, "versions": { - "botan": "1.12.9", + "botan": "1.12.10", "botan-math": "1.0.3", - "diet-ng": "1.4.3", - "eventcore": "0.8.27", - "libasync": "0.8.3", + "diet-ng": "1.5.0", + "eventcore": "0.8.41", + "libasync": "0.8.4", "libev": "5.0.0+4.04", "libevent": "2.0.2+2.0.16", - "memutils": "0.4.9", + "memutils": "0.4.13", + "mir-linux-kernel": "1.0.1", "openssl": "1.1.6+1.0.1g", - "stdx-allocator": "2.77.2", - "taggedalgebraic": "0.10.8", - "vibe-core": "1.4.0-alpha.1", - "vibe-d": "0.8.3-alpha.3" + "stdx-allocator": "2.77.5", + "taggedalgebraic": "0.10.13", + "vibe-core": "1.6.0", + "vibe-d": "0.8.4" } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/source/dub/commandline.d new/dub-1.16.0/source/dub/commandline.d --- old/dub-1.14.0/source/dub/commandline.d 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/source/dub/commandline.d 2019-07-02 11:57:23.000000000 +0200 @@ -67,7 +67,6 @@ new RemoveLocalCommand, new ListCommand, new SearchCommand, - new ListInstalledCommand, new AddOverrideCommand, new RemoveOverrideCommand, new ListOverridesCommand, @@ -489,6 +488,7 @@ this.helpText = [ "Initializes an empty package of the specified type in the given directory. By default, the current working directory is used." ]; + this.acceptsAppArgs = true; } override void prepare(scope CommandArgs args) @@ -499,6 +499,7 @@ "minimal - simple \"hello world\" project (default)", "vibe.d - minimal HTTP server based on vibe.d", "deimos - skeleton for C header bindings", + "custom - custom project provided by dub package", ]); args.getopt("f|format", &m_format, [ "Sets the format to use for the package description file. Possible values:", @@ -510,14 +511,13 @@ override int execute(Dub dub, string[] free_args, string[] app_args) { string dir; - enforceUsage(app_args.empty, "Unexpected application arguments."); if (free_args.length) { dir = free_args[0]; free_args = free_args[1 .. $]; } - string input(string caption, string default_value) + static string input(string caption, string default_value) { writef("%s [%s]: ", caption, default_value); auto inp = readln(); @@ -565,18 +565,11 @@ } } - //TODO: Remove this block in next version - // Checks if argument uses current method of specifying project type. - if (free_args.length) + if (!["vibe.d", "deimos", "minimal"].canFind(m_templateType)) { - if (["vibe.d", "deimos", "minimal"].canFind(free_args[0])) - { - m_templateType = free_args[0]; - free_args = free_args[1 .. $]; - logInfo("Deprecated use of init type. Use --type=[vibe.d | deimos | minimal] in future."); - } + free_args ~= m_templateType; } - dub.createEmptyPackage(NativePath(dir), free_args, m_templateType, m_format, &depCallback); + dub.createEmptyPackage(NativePath(dir), free_args, m_templateType, m_format, &depCallback, app_args); logInfo("Package successfully created in %s", dir.length ? dir : "."); return 0; @@ -717,7 +710,7 @@ enforce(package_name.length, "No valid root package found - aborting."); auto pack = dub.packageManager.getFirstPackage(package_name); - enforce(pack, "Failed to find a package named '"~package_name~"'."); + enforce(pack, "Failed to find a package named '"~package_name~"' locally."); logInfo("Building package %s in %s", pack.name, pack.path.toNativeString()); dub.rootPath = pack.path; dub.loadPackage(pack); @@ -829,6 +822,10 @@ } class BuildCommand : GenerateCommand { + protected { + bool m_yes; // automatic yes to prompts; + bool m_nonInteractive; + } this() { this.name = "build"; @@ -848,14 +845,87 @@ args.getopt("f|force", &m_force, [ "Forces a recompilation even if the target is up to date" ]); + args.getopt("y|yes", &m_yes, [ + `Automatic yes to prompts. Assume "yes" as answer to all interactive prompts.` + ]); + args.getopt("n|non-interactive", &m_nonInteractive, [ + "Don't enter interactive mode." + ]); super.prepare(args); m_generator = "build"; } override int execute(Dub dub, string[] free_args, string[] app_args) { + // single package files don't need to be downloaded, they are on the disk. + if (free_args.length < 1 || m_single) + return super.execute(dub, free_args, app_args); + + if (!m_nonInteractive) + { + const packageParts = splitPackageName(free_args[0]); + if (auto rc = fetchMissingPackages(dub, packageParts)) + return rc; + free_args[0] = packageParts.name; + } return super.execute(dub, free_args, app_args); } + + private int fetchMissingPackages(Dub dub, in PackageAndVersion packageParts) + { + + static bool input(string caption, bool default_value = true) { + writef("%s [%s]: ", caption, default_value ? "Y/n" : "y/N"); + auto inp = readln(); + string userInput = "y"; + if (inp.length > 1) + userInput = inp[0 .. $ - 1].toLower; + + switch (userInput) { + case "no", "n", "0": + return false; + case "yes", "y", "1": + default: + return true; + } + } + + Dependency dep; + + if (packageParts.version_.length > 0) { + // the user provided a version manually + dep = Dependency(packageParts.version_); + } else { + if (packageParts.name.startsWith(":") || + dub.packageManager.getFirstPackage(packageParts.name)) + // found locally + return 0; + + // search for the package and filter versions for exact matches + auto search = dub.searchPackages(packageParts.name) + .map!(tup => tup[1].find!(p => p.name == packageParts.name)) + .filter!(ps => !ps.empty); + if (search.empty) { + logWarn("Package '%s' was neither found locally nor online.", packageParts.name); + return 2; + } + + const p = search.front.front; + logInfo("Package '%s' was not found locally but is available online:", packageParts.name); + logInfo("---"); + logInfo("Description: %s", p.description); + logInfo("Version: %s", p.version_); + logInfo("---"); + + const answer = m_yes ? true : input("Do you want to fetch '%s' now?".format(packageParts.name)); + if (!answer) + return 0; + dep = Dependency(p.version_); + } + + dub.fetch(packageParts.name, dep, dub.defaultPlacementLocation, FetchOptions.none); + return 0; + } } class RunCommand : BuildCommand { @@ -1531,16 +1601,6 @@ } } -class ListInstalledCommand : ListCommand { - this() { this.name = "list-installed"; hidden = true; } - override void prepare(scope CommandArgs args) { super.prepare(args); } - override int execute(Dub dub, string[] free_args, string[] app_args) - { - warnRenamed("list-installed", "list"); - return super.execute(dub, free_args, app_args); - } -} - class SearchCommand : Command { this() { @@ -2162,26 +2222,35 @@ return true; } +private struct PackageAndVersion +{ + string name; + string version_; +} + /* Split <package>=<version-specifier> and <package>@<version-specifier> into `name` and `version_`. */ -private auto splitPackageName(string packageName) +private PackageAndVersion splitPackageName(string packageName) { - struct PackageAndVersion - { - string name; - string version_; - } // split <package>=<version-specifier> - auto parts = packageName.split("="); - if (parts.length == 1) { + auto parts = packageName.findSplit("="); + if (parts[1].empty) { // support splitting <package>@<version-specified> too - parts = packageName.split("@"); + parts = packageName.findSplit("@"); } PackageAndVersion p; p.name = parts[0]; - if (parts.length > 1) - p.version_ = parts[1]; + if (!parts[1].empty) + p.version_ = parts[2]; return p; } + +// https://github.com/dlang/dub/issues/1681 +unittest +{ + auto pv = splitPackageName(""); + assert(pv.name == ""); + assert(pv.version_ is null); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/source/dub/compilers/compiler.d new/dub-1.16.0/source/dub/compilers/compiler.d --- old/dub-1.14.0/source/dub/compilers/compiler.d 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/source/dub/compilers/compiler.d 2019-07-02 11:57:23.000000000 +0200 @@ -92,6 +92,9 @@ /// Convert linker flags to compiler format string[] lflagsToDFlags(in string[] lflags) const; + /// Determines compiler version + string determineVersion(string compiler_binary, string verboseOutput); + /** Runs a tool and provides common boilerplate code. This method should be used by `Compiler` implementations to invoke the @@ -123,19 +126,12 @@ compiler_binary = binary to invoke compiler with args = arguments for the probe compilation arch_override = special handler for x86_mscoff - versionRes = array of regular expressions to scan the output - and find the compiler version. For each, the - version must be in capture index 1. The output - is scanned in multi-line mode (i.e. ^ will match any line start) */ protected final BuildPlatform probePlatform(string compiler_binary, string[] args, - string arch_override, string[] versionRes) + string arch_override) { import dub.compilers.utils : generatePlatformProbeFile, readPlatformJsonProbe; - import std.algorithm : filter, map; - import std.range : takeOne; - import std.regex : matchFirst, regex; - import std.string : format; + import std.string : format, strip; auto fil = generatePlatformProbeFile(); @@ -151,17 +147,14 @@ `This will probably result in build errors.`, build_platform.compiler, this.name); } - auto ver = versionRes - .map!(re => matchFirst(result.output, regex(re, "m"))) - .filter!(c => c.length > 1) - .map!(c => c[1]) - .takeOne(); + auto ver = determineVersion(compiler_binary, result.output) + .strip; if (ver.empty) { logWarn(`Could not probe the compiler version for "%s". ` ~ `Toolchain requirements might be ineffective`, build_platform.compiler); } else { - build_platform.compilerVersion = ver.front; + build_platform.compilerVersion = ver; } // Hack: see #1059 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/source/dub/compilers/dmd.d new/dub-1.16.0/source/dub/compilers/dmd.d --- old/dub-1.14.0/source/dub/compilers/dmd.d 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/source/dub/compilers/dmd.d 2019-07-02 11:57:23.000000000 +0200 @@ -22,6 +22,24 @@ import std.process; import std.typecons; +// Determines whether the specified process is running under WOW64 or an Intel64 of x64 processor. +version (Windows) +private Nullable!bool isWow64() { + // See also: https://docs.microsoft.com/de-de/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getnativesysteminfo + import core.sys.windows.windows : GetNativeSystemInfo, SYSTEM_INFO, PROCESSOR_ARCHITECTURE_AMD64; + + static Nullable!bool result; + + // A process's architecture won't change over while the process is in memory + // Return the cached result + if (!result.isNull) + return result; + + SYSTEM_INFO systemInfo; + GetNativeSystemInfo(&systemInfo); + result = systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64; + return result; +} class DMDCompiler : Compiler { private static immutable s_options = [ @@ -81,12 +99,26 @@ assert(c && c.length > 1 && c[1] == "2.084.0-beta.1"); } + string determineVersion(string compiler_binary, string verboseOutput) + { + import std.regex : matchFirst, regex; + auto ver = matchFirst(verboseOutput, regex(dmdVersionRe, "m")); + return ver && ver.length > 1 ? ver[1] : null; + } + BuildPlatform determinePlatform(ref BuildSettings settings, string compiler_binary, string arch_override) { string[] arch_flags; switch (arch_override) { default: throw new Exception("Unsupported architecture: "~arch_override); - case "": break; + case "": + // Don't use Optlink by default on Windows + version (Windows) { + const is64bit = isWow64(); + if (!is64bit.isNull) + arch_flags = [is64bit.get ? "-m64" : "-m32mscoff"]; + } + break; case "x86": arch_flags = ["-m32"]; break; case "x86_64": arch_flags = ["-m64"]; break; case "x86_mscoff": arch_flags = ["-m32mscoff"]; break; @@ -96,8 +128,7 @@ return probePlatform( compiler_binary, arch_flags ~ ["-quiet", "-c", "-o-", "-v"], - arch_override, - [ dmdVersionRe ] + arch_override ); } @@ -262,7 +293,7 @@ string[] lflagsToDFlags(in string[] lflags) const { - return lflags.map!(f => "-L"~f)().array(); + return map!(f => "-L"~f)(lflags.filter!(f => f != "")()).array(); } private auto escapeArgs(in string[] args) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/source/dub/compilers/gdc.d new/dub-1.16.0/source/dub/compilers/gdc.d --- old/dub-1.14.0/source/dub/compilers/gdc.d 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/source/dub/compilers/gdc.d 2019-07-02 11:57:23.000000000 +0200 @@ -54,31 +54,15 @@ @property string name() const { return "gdc"; } - enum gdcVersionRe1 = `GDC\s+(\d+\.\d+\.\d+[A-Za-z0-9.+-]*)`; - enum gdcVersionRe2 = `^GNU D \(.*?\) version (\d+\.\d+\.\d+[A-Za-z0-9.+-]*)`; - enum gdcVersionRe3 = `^gcc version (\d+\.\d+\.\d+[A-Za-z0-9.+-]*)`; - - unittest { - import std.algorithm : equal, map; - import std.range : only; - import std.regex : matchFirst, regex; - auto probe = ` -Target: x86_64-pc-linux-gnu -Thread model: posix -gcc version 8.2.1 20180831 (GDC 8.2.1 based on D v2.068.2 built with ISL 0.20 for Arch Linux) -GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 -GNU D (GDC 8.2.1 based on D v2.068.2 built with ISL 0.20 for Arch Linux) version 8.2.1 20180831 (x86_64-pc-linux-gnu) -GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 -binary /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/cc1d -version v2.068.2 -predefs GNU D_Version2 LittleEndian GNU_DWARF2_Exceptions GNU_StackGrowsDown GNU_InlineAsm D_LP64 D_PIC assert all X86_64 D_HardFloat Posix linux CRuntime_Glibc -`; - auto vers = only(gdcVersionRe1, gdcVersionRe2, gdcVersionRe3) - .map!(re => matchFirst(probe, regex(re, "m"))) - .filter!(c => c && c.length > 1) - .map!(c => c[1]); + string determineVersion(string compiler_binary, string verboseOutput) + { + const result = execute([ + compiler_binary, + "-dumpfullversion", + "-dumpversion" + ]); - assert(vers.equal([ "8.2.1", "8.2.1", "8.2.1" ])); + return result.status == 0 ? result.output : null; } BuildPlatform determinePlatform(ref BuildSettings settings, string compiler_binary, string arch_override) @@ -97,8 +81,7 @@ return probePlatform( compiler_binary, arch_flags ~ ["-S", "-v"], - arch_override, - [ gdcVersionRe1, gdcVersionRe2, gdcVersionRe3 ] + arch_override ); } @@ -250,6 +233,9 @@ string[] dflags; foreach( f; lflags ) { + if ( f == "") { + continue; + } dflags ~= "-Xlinker"; dflags ~= f; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/source/dub/compilers/ldc.d new/dub-1.16.0/source/dub/compilers/ldc.d --- old/dub-1.14.0/source/dub/compilers/ldc.d 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/source/dub/compilers/ldc.d 2019-07-02 11:57:23.000000000 +0200 @@ -69,6 +69,13 @@ assert(c && c.length > 1 && c[1] == "1.11.0"); } + string determineVersion(string compiler_binary, string verboseOutput) + { + import std.regex : matchFirst, regex; + auto ver = matchFirst(verboseOutput, regex(ldcVersionRe, "m")); + return ver && ver.length > 1 ? ver[1] : null; + } + BuildPlatform determinePlatform(ref BuildSettings settings, string compiler_binary, string arch_override) { string[] arch_flags; @@ -83,8 +90,7 @@ return probePlatform( compiler_binary, arch_flags ~ ["-c", "-o-", "-v"], - arch_override, - [ ldcVersionRe ] + arch_override ); } @@ -230,7 +236,7 @@ string[] lflagsToDFlags(in string[] lflags) const { - return lflags.map!(s => "-L="~s)().array(); + return map!(f => "-L"~f)(lflags.filter!(f => f != "")()).array(); } private auto escapeArgs(in string[] args) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/source/dub/dub.d new/dub-1.16.0/source/dub/dub.d --- old/dub-1.14.0/source/dub/dub.d 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/source/dub/dub.d 2019-07-02 11:57:23.000000000 +0200 @@ -1168,7 +1168,8 @@ */ void createEmptyPackage(NativePath path, string[] deps, string type, PackageFormat format = PackageFormat.sdl, - scope void delegate(ref PackageRecipe, ref PackageFormat) recipe_callback = null) + scope void delegate(ref PackageRecipe, ref PackageFormat) recipe_callback = null, + string[] app_args = []) { if (!path.absolute) path = m_rootPath ~ path; path.normalize(); @@ -1196,10 +1197,40 @@ initPackage(path, depVers, type, format, recipe_callback); + if (!["vibe.d", "deimos", "minimal"].canFind(type)) { + runCustomInitialization(path, type, app_args); + } + //Act smug to the user. logInfo("Successfully created an empty project in '%s'.", path.toNativeString()); } + private void runCustomInitialization(NativePath path, string type, string[] runArgs) + { + string packageName = type; + auto template_pack = m_packageManager.getBestPackage(packageName, ">=0.0.0"); + if (!template_pack) template_pack = m_packageManager.getBestPackage(packageName, "~master"); + if (!template_pack) { + logInfo("%s is not present, getting and storing it user wide", packageName); + template_pack = fetch(packageName, Dependency(">=0.0.0"), defaultPlacementLocation, FetchOptions.none); + } + + Package initSubPackage = m_packageManager.getSubPackage(template_pack, "init-exec", false); + auto template_dub = new Dub(null, m_packageSuppliers); + template_dub.loadPackage(initSubPackage); + auto compiler_binary = this.defaultCompiler; + + GeneratorSettings settings; + settings.config = "application"; + settings.compiler = getCompiler(compiler_binary); + settings.platform = settings.compiler.determinePlatform(settings.buildSettings, compiler_binary, m_defaultArchitecture); + settings.buildType = "debug"; + settings.run = true; + settings.runArgs = runArgs; + initSubPackage.recipe.buildSettings.workingDirectory = path.toNativeString(); + template_dub.generateProject("build", settings); + } + /** Converts the package recipe of the loaded root package to the given format. Params: @@ -1599,7 +1630,7 @@ // note: external sub packages are handled further below auto spr = basepack.getInternalSubPackage(subname); if (!spr.isNull) { - auto sp = new Package(spr, basepack.path, basepack); + auto sp = new Package(spr.get, basepack.path, basepack); m_remotePackages[sp.name] = sp; return sp; } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/source/dub/generators/build.d new/dub-1.16.0/source/dub/generators/build.d --- old/dub-1.14.0/source/dub/generators/build.d 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/source/dub/generators/build.d 2019-07-02 11:57:23.000000000 +0200 @@ -335,7 +335,7 @@ private string computeBuildID(string config, in BuildSettings buildsettings, GeneratorSettings settings) { - import std.digest.digest; + import std.digest; import std.digest.md; import std.bitmanip; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/source/dub/init.d new/dub-1.16.0/source/dub/init.d --- old/dub-1.14.0/source/dub/init.d 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/source/dub/init.d 2019-07-02 11:57:23.000000000 +0200 @@ -82,7 +82,7 @@ } switch (type) { - default: throw new Exception("Unknown package init type: "~type); + default: break; case "minimal": initMinimalPackage(root_path, p, &processRecipe); break; case "vibe.d": initVibeDPackage(root_path, p, &processRecipe); break; case "deimos": initDeimosPackage(root_path, p, &processRecipe); break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/source/dub/internal/utils.d new/dub-1.16.0/source/dub/internal/utils.d --- old/dub-1.14.0/source/dub/internal/utils.d 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/source/dub/internal/utils.d 2019-07-02 11:57:23.000000000 +0200 @@ -366,13 +366,20 @@ on "unrecoverable failures" such as 404 not found Otherwise might throw anything else that `download` throws. See_Also: download + + The download times out if a connection cannot be established within + `timeout` ms, or if the average transfer rate drops below 10 bytes / s for + more than `timeout` seconds. Pass `0` as `timeout` to disable both timeout + mechanisms. + + Note: Timeouts are only implemented when curl is used (DubUseCurl). **/ -void retryDownload(URL url, NativePath filename, size_t retryCount = 3) +void retryDownload(URL url, NativePath filename, size_t retryCount = 3, uint timeout = 8) { foreach(i; 0..retryCount) { version(DubUseCurl) { try { - download(url, filename); + download(url, filename, timeout); return; } catch(HTTPStatusException e) { @@ -408,12 +415,12 @@ } ///ditto -ubyte[] retryDownload(URL url, size_t retryCount = 3) +ubyte[] retryDownload(URL url, size_t retryCount = 3, uint timeout = 8) { foreach(i; 0..retryCount) { version(DubUseCurl) { try { - return download(url); + return download(url, timeout); } catch(HTTPStatusException e) { if (e.status == 404) throw e; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/source/dub/packagesuppliers/maven.d new/dub-1.16.0/source/dub/packagesuppliers/maven.d --- old/dub-1.14.0/source/dub/packagesuppliers/maven.d 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/source/dub/packagesuppliers/maven.d 2019-07-02 11:57:23.000000000 +0200 @@ -17,6 +17,7 @@ import std.datetime : Clock, Duration, hours, SysTime, UTC; private { + enum httpTimeout = 16; URL m_mavenUrl; struct CacheEntry { Json data; SysTime cacheTime; } CacheEntry[string] m_metadataCache; @@ -57,7 +58,7 @@ auto url = m_mavenUrl~NativePath("%s/%s/%s-%s.zip".format(packageId, vers, packageId, vers)); try { - retryDownload(url, path); + retryDownload(url, path, 3, httpTimeout); return; } catch(HTTPStatusException e) { @@ -93,7 +94,7 @@ string xmlData; try - xmlData = cast(string)retryDownload(url); + xmlData = cast(string)retryDownload(url, 3, httpTimeout); catch(HTTPStatusException e) { if (e.status == 404) { logDebug("Maven metadata %s not found at %s (404): %s", packageId, description, e.msg); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/source/dub/packagesuppliers/registry.d new/dub-1.16.0/source/dub/packagesuppliers/registry.d --- old/dub-1.14.0/source/dub/packagesuppliers/registry.d 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/source/dub/packagesuppliers/registry.d 2019-07-02 11:57:23.000000000 +0200 @@ -63,7 +63,7 @@ } catch(HTTPStatusException e) { if (e.status == 404) throw e; - else logDebug("Failed to download package %s from %s", packageId, url); + else logDebug("Failed to download package %s from %s", packageId, url); } catch(Exception e) { logDebug("Failed to download package %s from %s", packageId, url); @@ -86,27 +86,21 @@ m_metadataCache.remove(packageId); } - auto url = m_registryUrl ~ NativePath(PackagesPath ~ "/" ~ packageId ~ ".json"); + auto url = m_registryUrl ~ NativePath("api/packages/infos?packages=[\"" ~ + packageId ~ "\"]&include_dependencies=true&minimize=true"); logDebug("Downloading metadata for %s", packageId); string jsonData; - try - jsonData = cast(string)retryDownload(url); - catch(HTTPStatusException e) { - if (e.status == 404) { - logDebug("Package %s not found at %s (404): %s", packageId, description, e.msg); - return Json(null); - } - else throw e; - } + jsonData = cast(string)retryDownload(url); Json json = parseJsonString(jsonData, url.toString()); - // strip readme data (to save size and time) - foreach (ref v; json["versions"]) - v.remove("readme"); - m_metadataCache[packageId] = CacheEntry(json, now); - return json; + foreach (pkg, info; json.get!(Json[string])) + { + logDebug("adding %s to metadata cache", pkg); + m_metadataCache[pkg] = CacheEntry(info, now); + } + return json[packageId]; } SearchResult[] searchPackages(string query) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/source/dub/project.d new/dub-1.16.0/source/dub/project.d --- old/dub-1.14.0/source/dub/project.d 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/source/dub/project.d 2019-07-02 11:57:23.000000000 +0200 @@ -1194,14 +1194,9 @@ foreach (var; vars) dst.put(processVars(var, project, pack, gsettings, are_paths)); } -private string processVars(Project, Package)(string var, in Project project, in Package pack,in GeneratorSettings gsettings, bool is_path) +private string processVars(Project, Package)(string var, in Project project, in Package pack, in GeneratorSettings gsettings, bool is_path) { - import std.regex : regex, replaceAll; - - auto varRE = regex(`\$([\w_]+)|\$\{([\w_]+)\}|(\$\$[\w_]+|\$\$\{[\w_]+\})`); - var = var.replaceAll!( - m => m[3].length ? m[3][1..$] : (getVariable(m[1].length ? m[1] : m[2], project, pack, gsettings)) - )(varRE); + var = var.expandVars!(varName => getVariable(varName, project, pack, gsettings)); if (is_path) { auto p = NativePath(var); if (!p.absolute) { @@ -1210,6 +1205,91 @@ } else return var; } +/// Expand variables using `$VAR_NAME` or `${VAR_NAME}` syntax. +/// `$$` escapes itself and is expanded to a single `$`. +private string expandVars(alias expandVar)(string s) +{ + import std.functional : not; + + auto result = appender!string; + + static bool isVarChar(char c) + { + import std.ascii; + return isAlphaNum(c) || c == '_'; + } + + while (true) + { + auto pos = s.indexOf('$'); + if (pos < 0) + { + result.put(s); + return result.data; + } + result.put(s[0 .. pos]); + s = s[pos + 1 .. $]; + enforce(s.length > 0, "Variable name expected at end of string"); + switch (s[0]) + { + case '$': + result.put("$"); + s = s[1 .. $]; + break; + case '{': + pos = s.indexOf('}'); + enforce(pos >= 0, "Could not find '}' to match '${'"); + result.put(expandVar(s[1 .. pos])); + s = s[pos + 1 .. $]; + break; + default: + pos = s.representation.countUntil!(not!isVarChar); + if (pos < 0) + pos = s.length; + result.put(expandVar(s[0 .. pos])); + s = s[pos .. $]; + break; + } + } +} + +unittest +{ + string[string] vars = + [ + "A" : "a", + "B" : "b", + ]; + + string expandVar(string name) { auto p = name in vars; enforce(p, name); return *p; } + + assert(expandVars!expandVar("") == ""); + assert(expandVars!expandVar("x") == "x"); + assert(expandVars!expandVar("$$") == "$"); + assert(expandVars!expandVar("x$$") == "x$"); + assert(expandVars!expandVar("$$x") == "$x"); + assert(expandVars!expandVar("$$$$") == "$$"); + assert(expandVars!expandVar("x$A") == "xa"); + assert(expandVars!expandVar("x$$A") == "x$A"); + assert(expandVars!expandVar("$A$B") == "ab"); + assert(expandVars!expandVar("${A}$B") == "ab"); + assert(expandVars!expandVar("$A${B}") == "ab"); + assert(expandVars!expandVar("a${B}") == "ab"); + assert(expandVars!expandVar("${A}b") == "ab"); + + import std.exception : assertThrown; + assertThrown(expandVars!expandVar("$")); + assertThrown(expandVars!expandVar("${}")); + assertThrown(expandVars!expandVar("$|")); + assertThrown(expandVars!expandVar("x$")); + assertThrown(expandVars!expandVar("$X")); + assertThrown(expandVars!expandVar("${")); + assertThrown(expandVars!expandVar("${X")); + + // https://github.com/dlang/dmd/pull/9275 + assert(expandVars!expandVar("$${DUB_EXE:-dub}") == "${DUB_EXE:-dub}"); +} + // Keep the following list up-to-date if adding more build settings variables. /// List of variables that can be used in build settings package(dub) immutable buildSettingsVars = [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/source/dub/version_.d new/dub-1.16.0/source/dub/version_.d --- old/dub-1.14.0/source/dub/version_.d 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/source/dub/version_.d 2019-07-02 11:57:23.000000000 +0200 @@ -1,2 +1,2 @@ module dub.version_; -enum dubVersion = "v1.14.0"; +enum dubVersion = "v1.16.0"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/test/issue1003-check-empty-ld-flags/dub.json new/dub-1.16.0/test/issue1003-check-empty-ld-flags/dub.json --- old/dub-1.14.0/test/issue1003-check-empty-ld-flags/dub.json 1970-01-01 01:00:00.000000000 +0100 +++ new/dub-1.16.0/test/issue1003-check-empty-ld-flags/dub.json 2019-07-02 11:57:23.000000000 +0200 @@ -0,0 +1,10 @@ +{ + "authors": [ + "--" + ], + "copyright": "Copyright © 2019, --", + "description": "--", + "license": "--", + "name": "issue1003-empty-ld-flags", + "lflags": [""] +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/test/issue1003-check-empty-ld-flags/source/app.d new/dub-1.16.0/test/issue1003-check-empty-ld-flags/source/app.d --- old/dub-1.14.0/test/issue1003-check-empty-ld-flags/source/app.d 1970-01-01 01:00:00.000000000 +0100 +++ new/dub-1.16.0/test/issue1003-check-empty-ld-flags/source/app.d 2019-07-02 11:57:23.000000000 +0200 @@ -0,0 +1,6 @@ +import std.stdio; + +void main() +{ + writeln("Edit source/app.d to start your project."); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/test/issue1003-check-empty-ld-flags.sh new/dub-1.16.0/test/issue1003-check-empty-ld-flags.sh --- old/dub-1.14.0/test/issue1003-check-empty-ld-flags.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/dub-1.16.0/test/issue1003-check-empty-ld-flags.sh 2019-07-02 11:57:23.000000000 +0200 @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +. $(dirname "${BASH_SOURCE[0]}")/common.sh + +cd ${CURR_DIR}/issue1003-check-empty-ld-flags + +${DUB} build --compiler=${DC} --force diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/test/issue1037-better-dependency-messages.sh new/dub-1.16.0/test/issue1037-better-dependency-messages.sh --- old/dub-1.14.0/test/issue1037-better-dependency-messages.sh 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/test/issue1037-better-dependency-messages.sh 2019-07-02 11:57:23.000000000 +0200 @@ -9,7 +9,7 @@ function cleanup { rm -f $temp_file - rm -f $temp_file + rm -f $temp_file2 } trap cleanup EXIT @@ -22,4 +22,4 @@ die 'output not containing conflict information' fi -exit 0 \ No newline at end of file +exit 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/test/issue1336-registry/api/packages/infos__packages=%5B%22gitcompatibledubpackage%22%5D&include_dependencies=true&minimize=true new/dub-1.16.0/test/issue1336-registry/api/packages/infos__packages=%5B%22gitcompatibledubpackage%22%5D&include_dependencies=true&minimize=true --- old/dub-1.14.0/test/issue1336-registry/api/packages/infos__packages=%5B%22gitcompatibledubpackage%22%5D&include_dependencies=true&minimize=true 1970-01-01 01:00:00.000000000 +0100 +++ new/dub-1.16.0/test/issue1336-registry/api/packages/infos__packages=%5B%22gitcompatibledubpackage%22%5D&include_dependencies=true&minimize=true 2019-07-02 11:57:23.000000000 +0200 @@ -0,0 +1,3 @@ +{ + "gitcompatibledubpackage": {"versions":[{"configurations":[{"name":"exe"},{"name":"lib"}],"version":"~master","name":"gitcompatibledubpackage"},{"version":"1.0.1","name":"gitcompatibledubpackage"},{"version":"1.0.2","name":"gitcompatibledubpackage"},{"version":"1.0.3","name":"gitcompatibledubpackage"},{"configurations":[{"name":"exe"},{"name":"lib"}],"version":"1.0.4","name":"gitcompatibledubpackage"}]} +} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/test/issue1336-registry/packages/gitcompatibledubpackage.json new/dub-1.16.0/test/issue1336-registry/packages/gitcompatibledubpackage.json --- old/dub-1.14.0/test/issue1336-registry/packages/gitcompatibledubpackage.json 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/test/issue1336-registry/packages/gitcompatibledubpackage.json 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -{"repository":{"project":"gitcompatibledubpackage","owner":"dlang-community","kind":"github"},"dateAdded":"2017-02-11T21:00:16","name":"gitcompatibledubpackage","categories":[],"owner":"5148973d2179ddb20b0002fd","id":"589f6d501c18646d0ee49f12","versions":[{"packageDescriptionFile":"dub.sdl","configurations":[{"name":"exe","targetType":"executable","mainSourceFile":"hello.d"},{"excludedSourceFiles":["hello.d"],"name":"lib","targetType":"library"}],"commitID":"9e3972be4c63790c32257220f40c0af7dc41bec5","importPaths":[".."],"name":"gitcompatibledubpackage","version":"~master","license":"public domain","readmeFile":"/README.md","date":"2017-09-18T18:18:35Z","description":"Example of a DUB package also usable as git submodule. For DUB test suite.","sourcePaths":["."]},{"packageDescriptionFile":"dub.json","commitID":"b62466d32dd6bbb0d45f9a73c91142205d1048e5","importPaths":[".."],"name":"gitcompatibledubpackage","version":"1.0.1","license":"public domain","readmeFile":"/README.md","date":"2015-10-31T11:09:14Z","description":"Example of a DUB package also usable as git submodule. For DUB test suite."},{"packageDescriptionFile":"dub.json","commitID":"cef89b5513a140b1e3417809f59d1957ddaad837","importPaths":[".."],"name":"gitcompatibledubpackage","version":"1.0.2","license":"public domain","readmeFile":"/README.md","date":"2015-10-31T11:23:53Z","description":"Example of a DUB package also usable as git submodule. For DUB test suite.","sourcePaths":["."]},{"packageDescriptionFile":"dub.json","commitID":"d36e49d31b26ea76e1670e9d5cd89aaac40fde75","importPaths":[".."],"name":"gitcompatibledubpackage","version":"1.0.3","targetType":"executable","license":"public domain","readmeFile":"/README.md","date":"2017-04-05T22:12:48Z","description":"Example of a DUB package also usable as git submodule. For DUB test suite.","mainSourceFile":"hello.d","sourcePaths":["."]},{"packageDescriptionFile":"dub.sdl","configurations":[{"name":"exe","targetType":"executable","mainSourceFile":"hello.d"},{"excludedSourceFiles":["hello.d"],"name":"lib","targetType":"library"}],"commitID":"9e3972be4c63790c32257220f40c0af7dc41bec5","importPaths":[".."],"name":"gitcompatibledubpackage","version":"1.0.4","license":"public domain","readmeFile":"/README.md","date":"2017-09-18T18:18:35Z","description":"Example of a DUB package also usable as git submodule. For DUB test suite.","sourcePaths":["."]}]} \ No newline at end of file Binary files old/dub-1.14.0/test/issue1651-custom-dub-init-type/custom-dub-init-dubpackage-1.0.1.zip and new/dub-1.16.0/test/issue1651-custom-dub-init-type/custom-dub-init-dubpackage-1.0.1.zip differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/test/issue1651-custom-dub-init-type.sh new/dub-1.16.0/test/issue1651-custom-dub-init-type.sh --- old/dub-1.14.0/test/issue1651-custom-dub-init-type.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/dub-1.16.0/test/issue1651-custom-dub-init-type.sh 2019-07-02 11:57:23.000000000 +0200 @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +. $(dirname "${BASH_SOURCE[0]}")/common.sh +DIR=$(dirname "${BASH_SOURCE[0]}") +packname="custom-dub-init-type-sample" + +$DUB remove custom-dub-init-dubpackage --non-interactive --version=* 2>/dev/null || true +$DUB init -n $packname --format sdl -t custom-dub-init-dubpackage --skip-registry=all --registry=file://"$DIR"/issue1651-custom-dub-init-type -- --foo=bar + +function cleanup { + rm -rf $packname +} + +if [ ! -e $packname/dub.sdl ]; then # it failed + cleanup + die $LINENO 'No dub.sdl file has been generated.' +fi + +cd $packname +if ! { ${DUB} 2>&1 || true; } | grep -cF 'foo=bar'; then + cd .. + cleanup + die $LINENO 'Custom init type.' +fi +cd .. +cleanup \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/test/issue1691-build-subpkg/.gitignore new/dub-1.16.0/test/issue1691-build-subpkg/.gitignore --- old/dub-1.14.0/test/issue1691-build-subpkg/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/dub-1.16.0/test/issue1691-build-subpkg/.gitignore 2019-07-02 11:57:23.000000000 +0200 @@ -0,0 +1,15 @@ +.dub +docs.json +__dummy.html +docs/ +/issue1691-build-subpkg +issue1691-build-subpkg.so +issue1691-build-subpkg.dylib +issue1691-build-subpkg.dll +issue1691-build-subpkg.a +issue1691-build-subpkg.lib +issue1691-build-subpkg-test-* +*.exe +*.o +*.obj +*.lst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/test/issue1691-build-subpkg/dub.sdl new/dub-1.16.0/test/issue1691-build-subpkg/dub.sdl --- old/dub-1.14.0/test/issue1691-build-subpkg/dub.sdl 1970-01-01 01:00:00.000000000 +0100 +++ new/dub-1.16.0/test/issue1691-build-subpkg/dub.sdl 2019-07-02 11:57:23.000000000 +0200 @@ -0,0 +1,3 @@ +name "issue1691-build-subpkg" +dependency ":subpkg" version="*" +subPackage "./subpkg/" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/test/issue1691-build-subpkg/subpkg/dub.sdl new/dub-1.16.0/test/issue1691-build-subpkg/subpkg/dub.sdl --- old/dub-1.14.0/test/issue1691-build-subpkg/subpkg/dub.sdl 1970-01-01 01:00:00.000000000 +0100 +++ new/dub-1.16.0/test/issue1691-build-subpkg/subpkg/dub.sdl 2019-07-02 11:57:23.000000000 +0200 @@ -0,0 +1 @@ +name "subpkg" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/test/issue1691-build-subpkg.sh new/dub-1.16.0/test/issue1691-build-subpkg.sh --- old/dub-1.14.0/test/issue1691-build-subpkg.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/dub-1.16.0/test/issue1691-build-subpkg.sh 2019-07-02 11:57:23.000000000 +0200 @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +. $(dirname "${BASH_SOURCE[0]}")/common.sh +$DUB build --root="$CURR_DIR/issue1691-build-subpkg" :subpkg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/test/issue877-auto-fetch-package-on-run.sh new/dub-1.16.0/test/issue877-auto-fetch-package-on-run.sh --- old/dub-1.14.0/test/issue877-auto-fetch-package-on-run.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/dub-1.16.0/test/issue877-auto-fetch-package-on-run.sh 2019-07-02 11:57:23.000000000 +0200 @@ -0,0 +1,34 @@ +#!/bin/bash + +set -eu -o pipefail +set -x +$DUB remove --version="*" gitcompatibledubpackage || true + +# check whether the interactive run mode works +echo "y" | $DUB run gitcompatibledubpackage | grep "Hello DUB" +$DUB remove gitcompatibledubpackage + +! (echo "n" | $DUB run gitcompatibledubpackage | grep "Hello DUB") +! $DUB remove gitcompatibledubpackage + +# check -y +$DUB run --yes gitcompatibledubpackage | grep "Hello DUB" +$DUB remove gitcompatibledubpackage + +# check --yes +$DUB run -y gitcompatibledubpackage | grep "Hello DUB" +$DUB remove gitcompatibledubpackage + +(! $DUB run --non-interactive gitcompatibledubpackage) 2>&1 | grep "Failed to find.*gitcompatibledubpackage.*locally" + +# check supplying versions directly +dub_log="$($DUB run [email protected])" +echo "$dub_log" | grep "Hello DUB" +echo "$dub_log" | grep "Fetching.*1.0.3" +$DUB remove gitcompatibledubpackage + +# check supplying an invalid version +(! $DUB run [email protected]) 2>&1 | \ + grep 'No package gitcompatibledubpackage was found matching the dependency 0[.]42[.]43' + +! $DUB remove gitcompatibledubpackage diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/test/test_registry.d new/dub-1.16.0/test/test_registry.d --- old/dub-1.14.0/test/test_registry.d 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/test/test_registry.d 2019-07-02 11:57:23.000000000 +0200 @@ -1,11 +1,42 @@ +#!/usr/bin/env dub /+dub.sdl: -dependency "vibe-d" version="~>0.8.3-alpha.1" +dependency "vibe-d" version="~>0.8.5" versions "VibeNoSSL" +/ +import vibe.d; + +/* +Provide a special API File Handler as Vibe.d's builtin serveStaticFiles +doesn't deal well with query params. +This will blindly check if the requestURI payload exists on the filesystem and if so, return the file. + +It replaces `?` with `__` for Windows compatibility. + +Params: + skip = initial part of the requestURI to skip over + folder = the base directory from which to serve API requests from +*/ +auto apiFileHandler(string skip, string folder) { + import std.functional : toDelegate; + void handler(HTTPServerRequest req, HTTPServerResponse res) { + import std.algorithm : skipOver; + import std.path : buildPath; + import std.file : exists; + // ? can't be part of path names on Windows + auto requestURI = req.requestURI.replace("?", "__"); + requestURI.skipOver(skip); + const reqFile = buildPath(folder, requestURI); + if (reqFile.exists) { + return req.sendFile(res, PosixPath(reqFile)); + } + } + return toDelegate(&handler); +} + void main(string[] args) { - import std.conv, vibe.d; + import std.conv; immutable folder = readRequiredOption!string("folder", "Folder to service files from."); immutable port = readRequiredOption!uint("port", "Port to use"); auto router = new URLRouter; @@ -18,6 +49,8 @@ }); router.get("*", folder.serveStaticFiles); router.get("/fallback/*", folder.serveStaticFiles(new HTTPFileServerSettings("/fallback"))); + router.get("/api/*", apiFileHandler("/", folder)); + router.get("/fallback/api/*", apiFileHandler("/fallback/", folder)); listenHTTP(text(":", port), router); runApplication(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dub-1.14.0/travis-ci.sh new/dub-1.16.0/travis-ci.sh --- old/dub-1.14.0/travis-ci.sh 2019-03-01 16:41:12.000000000 +0100 +++ new/dub-1.16.0/travis-ci.sh 2019-07-02 11:57:23.000000000 +0200 @@ -4,7 +4,7 @@ source ~/dlang/*/activate # activate host compiler -if [ -z "$FRONTEND" -o "$FRONTEND" \> 2.072.z ]; then +if [ -z "$FRONTEND" -o "$FRONTEND" \> 2.074.z ]; then vibe_ver=$(jq -r '.versions | .["vibe-d"]' < dub.selections.json) dub fetch vibe-d --version=$vibe_ver # get optional dependency dub test --compiler=${DC} -c library-nonet
