diff -Nru dub-1.1.1/CHANGELOG.md dub-1.2.0/CHANGELOG.md --- dub-1.1.1/CHANGELOG.md 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/CHANGELOG.md 2017-01-24 21:41:58.000000000 +0000 @@ -1,7 +1,43 @@ Changelog ========= -v1.1.1 - 2016-11- +v1.2.0 - 2017-01-22 +------------------- + +### Features and improvements ### + + - Added an `--override-config` command line option to force selecting specific configurations for dependencies - [pull #1004][issue1004] + - Implemented selective dependency upgrades ("dub upgrade ") - [issue #1024][issue1024] + - Multiple configurations with the same name are now detected and will cause a warning to be displayed - [issue #984][issue984] + - Updated the Sublime Text generator and the Bash completion script to include the default "release-debug" build type (by p0nce) - [pull #1028][issue1028] + - The `--force-remove` switch is scheduled for deprecation, as it didn't do anything for a while now - [pull #1023][issue1023] + +[issue984]: https://github.com/dlang/dub/issues/984 +[issue1004]: https://github.com/dlang/dub/issues/1004 +[issue1023]: https://github.com/dlang/dub/issues/1023 +[issue1024]: https://github.com/dlang/dub/issues/1024 +[issue1028]: https://github.com/dlang/dub/issues/1028 + + +v1.1.2 - 2016-12-31 +------------------- + +### Bug fixes ### + + - Fixes configuration resolution in diamond dependency settings - [issue #1005][issue1005], [pull #1006][issue1006] + - Fixed path based package overrides ("dub add-override") - [issue #779][issue779] + - Contains various diagnostic and error message improvements - [issue #957][issue957], [pull #1010][issue1010], [pull #1012][issue1012], [issue #1019][issue1019] + +[issue779]: https://github.com/dlang/dub/issues/779 +[issue957]: https://github.com/dlang/dub/issues/957 +[issue1005]: https://github.com/dlang/dub/issues/1005 +[issue1006]: https://github.com/dlang/dub/issues/1006 +[issue1010]: https://github.com/dlang/dub/issues/1010 +[issue1012]: https://github.com/dlang/dub/issues/1012 +[issue1019]: https://github.com/dlang/dub/issues/1019 + + + v1.1.1 - 2016-11-30 ------------------- ### Bug fixes ### diff -Nru dub-1.1.1/debian/changelog dub-1.2.0/debian/changelog --- dub-1.1.1/debian/changelog 2016-12-22 18:16:48.000000000 +0000 +++ dub-1.2.0/debian/changelog 2017-02-27 11:00:21.000000000 +0000 @@ -1,3 +1,16 @@ +dub (1.2.0-1ubuntu1) zesty; urgency=medium + + * Replace no-as-needed GDC linker hack + + -- Graham Inggs Mon, 27 Feb 2017 13:00:21 +0200 + +dub (1.2.0-1) unstable; urgency=medium + + * New upstream version: 1.2.0 + * Remove no-as-needed GDC linker hack + + -- Matthias Klumpp Tue, 24 Jan 2017 22:35:46 +0100 + dub (1.1.1-1) unstable; urgency=medium * New upstream version: 1.1.1 diff -Nru dub-1.1.1/debian/control dub-1.2.0/debian/control --- dub-1.1.1/debian/control 2016-10-24 19:10:15.000000000 +0000 +++ dub-1.2.0/debian/control 2017-02-27 11:00:21.000000000 +0000 @@ -1,10 +1,11 @@ Source: dub Section: devel Priority: optional -Maintainer: Debian D Language Group +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Debian D Language Group Uploaders: Matthias Klumpp Build-Depends: debhelper (>= 10), - gdc (>= 5.2), + gdc (>= 6.2), libcurl4-gnutls-dev | libcurl4-openssl-dev Standards-Version: 3.9.8 Homepage: http://code.dlang.org/ diff -Nru dub-1.1.1/dub.sdl dub-1.2.0/dub.sdl --- dub-1.1.1/dub.sdl 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/dub.sdl 2017-01-24 21:41:58.000000000 +0000 @@ -22,13 +22,13 @@ } configuration "library-nonet" { - dependency "vibe-d" version="~>0.7.29" optional=true + dependency "vibe-d:inet" version="~>0.7.30" optional=true targetType "library" excludedSourceFiles "source/app.d" } configuration "dynamic-library-nonet" { - dependency "vibe-d" version="~>0.7.29" optional=true + dependency "vibe-d:inet" version="~>0.7.30" optional=true targetType "dynamicLibrary" excludedSourceFiles "source/app.d" } diff -Nru dub-1.1.1/dub.selections.json dub-1.2.0/dub.selections.json --- dub-1.1.1/dub.selections.json 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/dub.selections.json 2017-01-24 21:41:58.000000000 +0000 @@ -5,7 +5,7 @@ "libev": "5.0.0+4.04", "libevent": "2.0.1+2.0.16", "memutils": "0.4.8", - "openssl": "1.1.4+1.0.1g", + "openssl": "1.1.5+1.0.1g", "vibe-d": "0.7.30" } } diff -Nru dub-1.1.1/scripts/fish-completion/dub.fish dub-1.2.0/scripts/fish-completion/dub.fish --- dub-1.1.1/scripts/fish-completion/dub.fish 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/scripts/fish-completion/dub.fish 2017-01-24 21:41:58.000000000 +0000 @@ -49,7 +49,7 @@ complete -c dub -n "contains '$cmd' (commandline -poc)" -s a -l arch -r -d "Force architecture" complete -c dub -n "contains '$cmd' (commandline -poc)" -s d -l debug -r -d "Debug identifier" complete -c dub -n "contains '$cmd' (commandline -poc)" -l nodeps -d "No dependency check" - complete -c dub -n "contains '$cmd' (commandline -poc)" -s b -l build -u -x -d "Build type" -a "debug plain release release-nobounds unittest profile docs ddox cov unittest-cov" + complete -c dub -n "contains '$cmd' (commandline -poc)" -s b -l build -u -x -d "Build type" -a "debug plain release release-debug release-nobounds unittest profile profile-gc docs ddox cov unittest-cov" complete -c dub -n "contains '$cmd' (commandline -poc)" -l build-mode -x -d "How compiler & linker are invoked" -a "separate allAtOnce singleFile" complete -c dub -n "contains '$cmd' (commandline -poc)" -l compiler -x -d "Compiler binary" -a "dmd gdc ldc gdmd ldmd" end diff -Nru dub-1.1.1/source/dub/commandline.d dub-1.2.0/source/dub/commandline.d --- dub-1.1.1/source/dub/commandline.d 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/source/dub/commandline.d 2017-01-24 21:41:58.000000000 +0000 @@ -212,6 +212,7 @@ if (!cmd.skipDubInitialization) { if (options.bare) { dub = new Dub(Path(getcwd())); + dub.rootPath = Path(options.root_path); dub.defaultPlacementLocation = options.placementLocation; } else { // initialize DUB @@ -542,6 +543,7 @@ string m_compilerName; string m_arch; string[] m_debugVersions; + string[] m_overrideConfigs; Compiler m_compiler; BuildPlatform m_buildPlatform; BuildSettings m_buildSettings; @@ -561,6 +563,10 @@ args.getopt("c|config", &m_buildConfig, [ "Builds the specified configuration. Configurations can be defined in dub.json" ]); + args.getopt("override-config", &m_overrideConfigs, [ + "Uses the specified configuration for a certain dependency. Can be specified multiple times.", + "Format: --override-config=/" + ]); args.getopt("compiler", &m_compilerName, [ "Specifies the compiler binary to use (can be a path).", "Arbitrary pre- and suffixes to the identifiers below are recognized (e.g. ldc2 or dmd-2.063) and matched to the proper compiler type:", @@ -575,9 +581,6 @@ args.getopt("nodeps", &m_nodeps, [ "Do not check/update dependencies before building" ]); - args.getopt("force-remove", &m_forceRemove, [ - "Force deletion of fetched packages with untracked files when upgrading" - ]); args.getopt("build-mode", &m_buildMode, [ "Specifies the way the compiler and linker are invoked. Valid values:", " separate (default), allAtOnce, singleFile" @@ -585,6 +588,9 @@ args.getopt("single", &m_single, [ "Treats the package name as a filename. The file must contain a package recipe comment." ]); + args.getopt("force-remove", &m_forceRemove, [ + "Deprecated option that does nothing." + ]); } protected void setupPackage(Dub dub, string package_name, string default_build_type = "debug") @@ -629,6 +635,12 @@ } dub.project.validate(); + + foreach (sc; m_overrideConfigs) { + auto idx = sc.indexOf('/'); + enforceUsage(idx >= 0, "Expected \"/\" as argument to --override-config."); + dub.project.overrideConfiguration(sc[0 .. idx], sc[idx+1 .. $]); + } } private bool loadSpecificPackage(Dub dub, string package_name) @@ -1077,14 +1089,14 @@ this() { this.name = "upgrade"; - this.argumentsPattern = "[]"; - this.description = "Forces an upgrade of all dependencies"; + this.argumentsPattern = "[]"; + this.description = "Forces an upgrade of the dependencies"; this.helpText = [ "Upgrades all dependencies of the package by querying the package registry(ies) for new versions.", "", - "This will also update the versions stored in the selections file ("~SelectedVersions.defaultFile~") accordingly.", + "This will update the versions stored in the selections file ("~SelectedVersions.defaultFile~") accordingly.", "", - "If a package specified, (only) that package will be upgraded. Otherwise all direct and indirect dependencies of the current package will get upgraded." + "If one or more package names are specified, only those dependencies will be upgraded. Otherwise all direct and indirect dependencies of the root package will get upgraded." ]; } @@ -1093,15 +1105,15 @@ args.getopt("prerelease", &m_prerelease, [ "Uses the latest pre-release version, even if release versions are available" ]); - args.getopt("force-remove", &m_forceRemove, [ - "Force deletion of fetched packages with untracked files" - ]); args.getopt("verify", &m_verify, [ "Updates the project and performs a build. If successful, rewrites the selected versions file ." ]); args.getopt("missing-only", &m_missingOnly, [ "Performs an upgrade only for dependencies that don't yet have a version selected. This is also done automatically before each build." ]); + args.getopt("force-remove", &m_forceRemove, [ + "Deprecated option that does nothing." + ]); } override int execute(Dub dub, string[] free_args, string[] app_args) @@ -1114,9 +1126,7 @@ auto options = UpgradeOptions.upgrade|UpgradeOptions.select; if (m_missingOnly) options &= ~UpgradeOptions.upgrade; if (m_prerelease) options |= UpgradeOptions.preRelease; - if (m_forceRemove) options |= UpgradeOptions.forceRemove; - enforceUsage(app_args.length == 0, "Upgrading a specific package is not yet implemented."); - dub.upgrade(options); + dub.upgrade(options, free_args); return 0; } } @@ -1135,7 +1145,7 @@ ]); args.getopt("force-remove", &m_forceRemove, [ - "Force deletion of fetched packages with untracked files" + "Deprecated option that does nothing" ]); } @@ -1182,7 +1192,6 @@ FetchOptions fetchOpts; fetchOpts |= FetchOptions.forceBranchUpgrade; - fetchOpts |= m_forceRemove ? FetchOptions.forceRemove : FetchOptions.none; if (m_version.length) dub.fetch(name, Dependency(m_version), location, fetchOpts); else { try { @@ -1269,9 +1278,9 @@ } if (m_nonInteractive || !m_version.empty) - dub.remove(package_id, m_version, location, m_forceRemove); + dub.remove(package_id, m_version, location); else - dub.remove(package_id, location, m_forceRemove, &resolveVersion); + dub.remove(package_id, location, &resolveVersion); return 0; } } @@ -1404,6 +1413,8 @@ override void prepare(scope CommandArgs args) {} override int execute(Dub dub, string[] free_args, string[] app_args) { + enforceUsage(free_args.length == 0, "Expecting no extra arguments."); + enforceUsage(app_args.length == 0, "The list command supports no application arguments."); logInfo("Packages present in the system and known to dub:"); foreach (p; dub.packageManager.getPackageIterator()) logInfo(" %s %s: %s", p.name, p.version_, p.path.toNativeString()); @@ -1493,6 +1504,7 @@ auto ver = Dependency(free_args[1]); if (existsFile(Path(free_args[2]))) { auto target = Path(free_args[2]); + if (!target.absolute) target = Path(getcwd()) ~ target; dub.packageManager.addOverride(scope_, pack, ver, target); logInfo("Added override %s %s => %s", pack, ver, target); } else { @@ -1621,7 +1633,7 @@ { args.getopt("compiler-status", &m_compilerStatusCode, ["The expected status code of the compiler run"]); args.getopt("compiler-regex", &m_compilerRegex, ["A regular expression used to match against the compiler output"]); - args.getopt("linker-status", &m_linkerStatusCode, ["The expected status code of the liner run"]); + args.getopt("linker-status", &m_linkerStatusCode, ["The expected status code of the linker run"]); args.getopt("linker-regex", &m_linkerRegex, ["A regular expression used to match against the linker output"]); args.getopt("program-status", &m_programStatusCode, ["The expected status code of the built executable"]); args.getopt("program-regex", &m_programRegex, ["A regular expression used to match against the program output"]); diff -Nru dub-1.1.1/source/dub/compilers/dmd.d dub-1.2.0/source/dub/compilers/dmd.d --- dub-1.1.1/source/dub/compilers/dmd.d 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/source/dub/compilers/dmd.d 2017-01-24 21:41:58.000000000 +0000 @@ -63,6 +63,7 @@ case "": break; case "x86": arch_flags = ["-m32"]; break; case "x86_64": arch_flags = ["-m64"]; break; + case "x86_mscoff": arch_flags = ["-m32mscoff"]; break; } settings.addDFlags(arch_flags); diff -Nru dub-1.1.1/source/dub/compilers/utils.d dub-1.2.0/source/dub/compilers/utils.d --- dub-1.1.1/source/dub/compilers/utils.d 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/source/dub/compilers/utils.d 2017-01-24 21:41:58.000000000 +0000 @@ -83,6 +83,7 @@ void resolveLibs(ref BuildSettings settings) { import std.string : format; + import std.array : array; if (settings.libs.length == 0) return; @@ -174,7 +175,7 @@ {["-debug="], `Use "debugVersions" to specify version constants in a compiler independent way`}, {["-I"], `Use "importPaths" to specify import paths in a compiler independent way`}, {["-J"], `Use "stringImportPaths" to specify import paths in a compiler independent way`}, - {["-m32", "-m64"], `Use --arch=x86/--arch=x86_64 to specify the target architecture`} + {["-m32", "-m64", "-m32mscoff"], `Use --arch=x86/--arch=x86_64/--arch=x86_mscoff to specify the target architecture`} ]; struct SpecialOption { diff -Nru dub-1.1.1/source/dub/dependencyresolver.d dub-1.2.0/source/dub/dependencyresolver.d --- dub-1.1.1/source/dub/dependencyresolver.d 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/source/dub/dependencyresolver.d 2017-01-24 21:41:58.000000000 +0000 @@ -122,8 +122,6 @@ auto config_indices = new size_t[all_configs.length]; config_indices[] = 0; - string last_error; - visited = null; sizediff_t validateConfigs(TreeNode parent, ref string error) { @@ -162,7 +160,7 @@ } // choose another parent config to avoid the invalid child if (parentidx > maxcpi) { - error = format("Package %s contains invalid dependency %s", parent.pack, ch.pack); + error = format("Package %s contains invalid dependency %s (no version candidates)", parent.pack, ch.pack); logDiagnostic("%s (ci=%s)", error, parentidx); maxcpi = parentidx; } @@ -205,7 +203,7 @@ visited = null; string error; auto conflict_index = validateConfigs(root, error); - if (first_error !is null) first_error = error; + if (first_error is null) first_error = error; // print out current iteration state logDebug("Interation (ci=%s) %s", conflict_index, { diff -Nru dub-1.1.1/source/dub/dub.d dub-1.2.0/source/dub/dub.d --- dub-1.1.1/source/dub/dub.d 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/source/dub/dub.d 2017-01-24 21:41:58.000000000 +0000 @@ -338,8 +338,15 @@ string getDefaultConfiguration(BuildPlatform platform, bool allow_non_library_configs = true) const { return m_project.getDefaultConfiguration(platform, allow_non_library_configs); } /** Attempts to upgrade the dependency selection of the loaded project. + + Params: + options = Flags that control how the upgrade is carried out + packages_to_upgrade = Optional list of packages. If this list + contains one or more packages, only those packages will + be upgraded. Otherwise, all packages will be upgraded at + once. */ - void upgrade(UpgradeOptions options) + void upgrade(UpgradeOptions options, string[] packages_to_upgrade = null) { // clear non-existent version selections if (!(options & UpgradeOptions.upgrade)) { @@ -371,11 +378,13 @@ } Dependency[string] versions; - if ((options & UpgradeOptions.useCachedResult) && m_project.isUpgradeCacheUpToDate()) { + if ((options & UpgradeOptions.useCachedResult) && m_project.isUpgradeCacheUpToDate() && !packages_to_upgrade.length) { logDiagnostic("Using cached upgrade results..."); versions = m_project.getUpgradeCache(); } else { auto resolver = new DependencyVersionResolver(this, options); + foreach (p; packages_to_upgrade) + resolver.addPackageToUpgrade(p); versions = resolver.resolve(m_project.rootPackage, m_project.selections); if (options & UpgradeOptions.useCachedResult) { logDiagnostic("Caching upgrade results..."); @@ -427,14 +436,13 @@ { // TODO: only re-install if there is actually a new commit available logInfo("Re-installing branch based dependency %s %s", p, ver.toString()); - m_packageManager.remove(pack, (options & UpgradeOptions.forceRemove) != 0); + m_packageManager.remove(pack); pack = null; } } FetchOptions fetchOpts; fetchOpts |= (options & UpgradeOptions.preRelease) != 0 ? FetchOptions.usePrerelease : FetchOptions.none; - fetchOpts |= (options & UpgradeOptions.forceRemove) != 0 ? FetchOptions.forceRemove : FetchOptions.none; if (!pack) fetch(p, ver, defaultPlacementLocation, fetchOpts, "getting selected version"); if ((options & UpgradeOptions.select) && p != m_project.rootPackage.name) { if (ver.path.empty) m_project.selections.selectVersion(p, ver.version_); @@ -484,7 +492,7 @@ auto generator = createProjectGenerator("build", m_project); - auto test_config = format("__test__%s__", config); + auto test_config = format("%s-test-%s", m_project.rootPackage.name.replace(".", "-"), config); BuildSettings lbuildsettings = settings.buildSettings; m_project.addBuildSettings(lbuildsettings, settings.platform, config, null, true); @@ -493,9 +501,8 @@ return; } - if (lbuildsettings.targetType == TargetType.executable) { - if (config == "unittest") logInfo("Running custom 'unittest' configuration.", config); - else logInfo(`Configuration '%s' does not output a library. Falling back to "dub -b unittest -c %s".`, config, config); + if (lbuildsettings.targetType == TargetType.executable && config == "unittest") { + logInfo("Running custom 'unittest' configuration.", config); if (!custom_main_file.empty) logWarn("Ignoring custom main file."); settings.config = config; } else if (lbuildsettings.sourceFiles.empty) { @@ -514,6 +521,10 @@ tcinfo.versions[""] ~= "VibeCustomMain"; m_project.rootPackage.recipe.buildSettings.versions[""] = m_project.rootPackage.recipe.buildSettings.versions.get("", null).remove!(v => v == "VibeDefaultMain"); // TODO: remove this ^ once vibe.d has removed the default main implementation + + auto mainfil = tcinfo.mainSourceFile; + if (!mainfil.length) mainfil = m_project.rootPackage.recipe.buildSettings.mainSourceFile; + string custommodname; if (custom_main_file.length) { import std.path; @@ -522,10 +533,22 @@ custommodname = custom_main_file.head.toString().baseName(".d"); } + // prepare the list of tested modules string[] import_modules; foreach (file; lbuildsettings.sourceFiles) { - if (file.endsWith(".d") && Path(file).head.toString() != "package.d") + if (file.endsWith(".d")) { + auto fname = Path(file).head.toString(); + if (Path(file).relativeTo(m_project.rootPackage.path) == Path(mainfil)) { + logWarn("Excluding main source file %s from test.", mainfil); + tcinfo.excludedSourceFiles[""] ~= mainfil; + continue; + } + if (fname == "package.d") { + logWarn("Excluding package.d file %s from test due to https://issues.dlang.org/show_bug.cgi?id=11847"); + continue; + } import_modules ~= dub.internal.utils.determineModuleName(lbuildsettings, Path(file), m_project.rootPackage.path); + } } // generate main file @@ -662,7 +685,7 @@ return existing; } else { logInfo("Removing %s %s to prepare replacement with a new version.", packageId, ver); - if (!m_dryRun) m_packageManager.remove(existing, (options & FetchOptions.forceRemove) != 0); + if (!m_dryRun) m_packageManager.remove(existing); } } @@ -707,13 +730,17 @@ Params: pack = Package instance to remove - force_remove = Forces removal of the package, even if untracked - files are found in its folder. */ - void remove(in Package pack, bool force_remove) + void remove(in Package pack) { logInfo("Removing %s in %s", pack.name, pack.path.toNativeString()); - if (!m_dryRun) m_packageManager.remove(pack, force_remove); + if (!m_dryRun) m_packageManager.remove(pack); + } + + /// Compatibility overload. Use the version without a `force_remove` argument instead. + void remove(in Package pack, bool force_remove) + { + remove(pack); } /// @see remove(string, string, RemoveLocation) @@ -729,11 +756,9 @@ package_id = Name of the package to be removed location_ = Specifies the location to look for the given package name/version. - force_remove = Forces removal of the package, even if untracked - files are found in its folder. resolve_version = Callback to select package version. */ - void remove(string package_id, PlacementLocation location, bool force_remove, + void remove(string package_id, PlacementLocation location, scope size_t delegate(in Package[] packages) resolve_version) { enforce(!package_id.empty); @@ -766,7 +791,7 @@ logDebug("Removing %s packages.", packages.length); foreach(pack; packages) { try { - remove(pack, force_remove); + remove(pack); logInfo("Removed %s, version %s.", package_id, pack.version_); } catch (Exception e) { logError("Failed to remove %s %s: %s", package_id, pack.version_, e.msg); @@ -775,6 +800,13 @@ } } + /// Compatibility overload. Use the version without a `force_remove` argument instead. + void remove(string package_id, PlacementLocation location, bool force_remove, + scope size_t delegate(in Package[] packages) resolve_version) + { + remove(package_id, location, resolve_version); + } + /** Removes a specific version of a package. Params: @@ -785,12 +817,10 @@ exception, if there are multiple versions retrieved. location_ = Specifies the location to look for the given package name/version. - force_remove = Forces removal of the package, even if untracked - files are found in its folder. */ - void remove(string package_id, string version_, PlacementLocation location, bool force_remove) + void remove(string package_id, string version_, PlacementLocation location) { - remove(package_id, location, force_remove, (in packages) { + remove(package_id, location, (in packages) { if (version_ == RemoveVersionWildcard) return packages.length; if (version_.empty && packages.length > 1) { @@ -812,6 +842,12 @@ }); } + /// Compatibility overload. Use the version without a `force_remove` argument instead. + void remove(string package_id, string version_, PlacementLocation location, bool force_remove) + { + remove(package_id, version_, location); + } + /** Adds a directory to the list of locally known packages. Forwards to `PackageManager.addLocalPackage`. @@ -1030,7 +1066,7 @@ auto tool_pack = m_packageManager.getBestPackage(tool, ">=0.0.0"); if (!tool_pack) tool_pack = m_packageManager.getBestPackage(tool, "~master"); if (!tool_pack) { - logInfo("% is not present, getting and storing it user wide", tool); + logInfo("%s is not present, getting and storing it user wide", tool); tool_pack = fetch(tool, Dependency(">=0.0.0"), defaultPlacementLocation, FetchOptions.none); } @@ -1117,7 +1153,7 @@ none = 0, forceBranchUpgrade = 1<<0, usePrerelease = 1<<1, - forceRemove = 1<<2, + forceRemove = 1<<2, /// Deprecated, does nothing. printOnly = 1<<3, } @@ -1127,7 +1163,7 @@ none = 0, upgrade = 1<<1, /// Upgrade existing packages preRelease = 1<<2, /// inclde pre-release versions in upgrade - forceRemove = 1<<3, /// Force removing package folders, which contain unknown files + forceRemove = 1<<3, /// Deprecated, does nothing. select = 1<<4, /// Update the dub.selections.json file with the upgraded versions printUpgradesOnly = 1<<5, /// Instead of downloading new packages, just print a message to notify the user of their existence useCachedResult = 1<<6, /// Use cached information stored with the package to determine upgrades @@ -1149,6 +1185,7 @@ Package[string] m_remotePackages; SelectedVersions m_selectedVersions; Package m_rootPackage; + bool[string] m_packagesToUpgrade; } @@ -1158,6 +1195,11 @@ m_options = options; } + void addPackageToUpgrade(string name) + { + m_packagesToUpgrade[name] = true; + } + Dependency[string] resolve(Package root, SelectedVersions selected_versions) { m_rootPackage = root; @@ -1165,12 +1207,17 @@ return super.resolve(TreeNode(root.name, Dependency(root.version_)), (m_options & UpgradeOptions.printUpgradesOnly) == 0); } + protected bool isFixedPackage(string pack) + { + return m_packagesToUpgrade !is null && pack !in m_packagesToUpgrade; + } + protected override Dependency[] getAllConfigs(string pack) { if (auto pvers = pack in m_packageVersions) return *pvers; - if (!(m_options & UpgradeOptions.upgrade) && m_selectedVersions.hasSelectedVersion(pack)) { + if ((!(m_options & UpgradeOptions.upgrade) || isFixedPackage(pack)) && m_selectedVersions.hasSelectedVersion(pack)) { auto ret = [m_selectedVersions.getSelectedVersion(pack)]; logDiagnostic("Using fixed selection %s %s", pack, ret[0]); m_packageVersions[pack] = ret; @@ -1361,7 +1408,6 @@ try { FetchOptions fetchOpts; fetchOpts |= prerelease ? FetchOptions.usePrerelease : FetchOptions.none; - fetchOpts |= (m_options & UpgradeOptions.forceRemove) != 0 ? FetchOptions.forceRemove : FetchOptions.none; m_dub.fetch(rootpack, dep, m_dub.defaultPlacementLocation, fetchOpts, "need sub package description"); auto ret = m_dub.m_packageManager.getBestPackage(name, dep); if (!ret) { diff -Nru dub-1.1.1/source/dub/generators/build.d dub-1.2.0/source/dub/generators/build.d --- dub-1.1.1/source/dub/generators/build.d 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/source/dub/generators/build.d 2017-01-24 21:41:58.000000000 +0000 @@ -69,7 +69,7 @@ auto bs = ti.buildSettings.dup; foreach (ldep; ti.linkDependencies) { auto dbs = targets[ldep].buildSettings; - if (bs.targetType != TargetType.staticLibrary) { + if (bs.targetType != TargetType.staticLibrary && !(bs.options & BuildOption.syntaxOnly)) { bs.addSourceFiles(target_paths[ldep].toNativeString()); } else { additional_dep_files ~= target_paths[ldep]; @@ -462,9 +462,9 @@ on the other compilers. Later this should be integrated somehow in the build process (either in the dub.json, or using a command line flag) */ - } else if (settings.buildMode == BuildMode.allAtOnce || settings.compiler.name != "dmd" || !generate_binary || is_static_library) { + } else if (generate_binary && (settings.buildMode == BuildMode.allAtOnce || settings.compiler.name != "dmd" || is_static_library)) { // setup for command line - if (generate_binary) settings.compiler.setTarget(buildsettings, settings.platform); + settings.compiler.setTarget(buildsettings, settings.platform); settings.compiler.prepareBuildSettings(buildsettings, BuildSetting.commandLine); // don't include symbols of dependencies (will be included by the top level target) @@ -480,20 +480,23 @@ // setup linker command line auto lbuildsettings = buildsettings; lbuildsettings.sourceFiles = lbuildsettings.sourceFiles.filter!(f => isLinkerFile(f)).array; - settings.compiler.setTarget(lbuildsettings, settings.platform); + if (generate_binary) settings.compiler.setTarget(lbuildsettings, settings.platform); settings.compiler.prepareBuildSettings(lbuildsettings, BuildSetting.commandLineSeparate|BuildSetting.sourceFiles); // setup compiler command line buildsettings.libs = null; buildsettings.lflags = null; - buildsettings.addDFlags("-c", "-of"~tempobj.toNativeString()); + if (generate_binary) buildsettings.addDFlags("-c", "-of"~tempobj.toNativeString()); buildsettings.sourceFiles = buildsettings.sourceFiles.filter!(f => !isLinkerFile(f)).array; + settings.compiler.prepareBuildSettings(buildsettings, BuildSetting.commandLine); settings.compiler.invoke(buildsettings, settings.platform, settings.compileCallback); - logInfo("Linking..."); - settings.compiler.invokeLinker(lbuildsettings, settings.platform, [tempobj.toNativeString()], settings.linkCallback); + if (generate_binary) { + logInfo("Linking..."); + settings.compiler.invokeLinker(lbuildsettings, settings.platform, [tempobj.toNativeString()], settings.linkCallback); + } } } diff -Nru dub-1.1.1/source/dub/generators/sublimetext.d dub-1.2.0/source/dub/generators/sublimetext.d --- dub-1.1.1/source/dub/generators/sublimetext.d 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/source/dub/generators/sublimetext.d 2017-01-24 21:41:58.000000000 +0000 @@ -70,6 +70,7 @@ //"plain", "debug", "release", + "release-debug", "release-nobounds", //"unittest", "docs", diff -Nru dub-1.1.1/source/dub/init.d dub-1.2.0/source/dub/init.d --- dub-1.1.1/source/dub/init.d 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/source/dub/init.d 2017-01-24 21:41:58.000000000 +0000 @@ -113,18 +113,17 @@ private void initVibeDPackage(Path root_path, ref PackageRecipe p, scope void delegate() pre_write_callback) { if ("vibe-d" !in p.buildSettings.dependencies) - p.buildSettings.dependencies["vibe-d"] = Dependency("~>0.7.28"); + p.buildSettings.dependencies["vibe-d"] = Dependency("~>0.7.30"); p.description = "A simple vibe.d server application."; - p.buildSettings.versions[""] ~= "VibeDefaultMain"; pre_write_callback(); createDirectory(root_path ~ "source"); createDirectory(root_path ~ "views"); createDirectory(root_path ~ "public"); write((root_path ~ "source/app.d").toNativeString(), -q{import vibe.d; +q{import vibe.vibe; -shared static this() +void main() { auto settings = new HTTPServerSettings; settings.port = 8080; @@ -132,6 +131,7 @@ listenHTTP(settings, &hello); logInfo("Please open http://127.0.0.1:8080/ in your browser."); + runApplication(); } void hello(HTTPServerRequest req, HTTPServerResponse res) diff -Nru dub-1.1.1/source/dub/internal/vibecompat/data/json.d dub-1.2.0/source/dub/internal/vibecompat/data/json.d --- dub-1.1.1/source/dub/internal/vibecompat/data/json.d 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/source/dub/internal/vibecompat/data/json.d 2017-01-24 21:41:58.000000000 +0000 @@ -11,7 +11,7 @@ */ module dub.internal.vibecompat.data.json; -version (Have_vibe_d) public import vibe.data.json; +version (Have_vibe_d_data) public import vibe.data.json; else: import dub.internal.vibecompat.data.utils; @@ -892,12 +892,12 @@ case '0': .. case '9': case '-': bool is_float; - auto num = skipNumber(range, is_float); + auto num = skipNumber(range, is_float, filename, line); if( is_float ) ret = to!double(num); else ret = to!long(num); break; case '\"': - ret = skipJsonString(range); + ret = skipJsonString(range, filename, line); break; case '[': Json[] arr; @@ -924,7 +924,7 @@ skipWhitespace(range, line); enforceJson(!range.empty, "Missing '}' before EOF.", filename, line); if(range.front == '}') break; - string key = skipJsonString(range); + string key = skipJsonString(range, filename, line); skipWhitespace(range, line); enforceJson(range.startsWith(":"), "Expected ':' for key '" ~ key ~ "'", filename, line); range.popFront(); @@ -1647,7 +1647,7 @@ m_range.skipWhitespace(&m_line); } else first = false; - auto name = m_range.skipJsonString(&m_line); + auto name = m_range.skipJsonString(null, &m_line); m_range.skipWhitespace(&m_line); enforceJson(!m_range.empty && m_range.front == ':', "Expecting ':', not '"~m_range.front.to!string~"'."); @@ -1692,7 +1692,7 @@ return ret; } else static if (is(T : long)) { bool is_float; - auto num = m_range.skipNumber(is_float); + auto num = m_range.skipNumber(is_float, null, &m_line); enforceJson(!is_float, "Expecting integer number."); return to!T(num); } else static if (is(T : real)) { @@ -1700,7 +1700,7 @@ auto num = m_range.skipNumber(is_float); return to!T(num); } - else static if (is(T == string)) return m_range.skipJsonString(&m_line); + else static if (is(T == string)) return m_range.skipJsonString(null, &m_line); else static if (is(T == Json)) return m_range.parseJson(&m_line); else static if (isJsonSerializable!T) return T.fromJson(m_range.parseJson(&m_line)); else static assert(false, "Unsupported type: " ~ T.stringof); @@ -1955,7 +1955,7 @@ } /// private -private string jsonUnescape(R)(ref R range) +private string jsonUnescape(R)(ref R range, string filename, int* line) { auto ret = appender!string(); while(!range.empty){ @@ -1964,9 +1964,9 @@ case '"': return ret.data; case '\\': range.popFront(); - enforceJson(!range.empty, "Unterminated string escape sequence."); + enforceJson(!range.empty, "Unterminated string escape sequence.", filename, line); switch(range.front){ - default: enforceJson(false, "Invalid string escape sequence."); break; + default: enforceJson(false, "Invalid string escape sequence.", filename, line); break; case '"': ret.put('\"'); range.popFront(); break; case '\\': ret.put('\\'); range.popFront(); break; case '/': ret.put('/'); range.popFront(); break; @@ -1983,14 +1983,14 @@ dchar uch = 0; foreach( i; 0 .. 4 ){ uch *= 16; - enforceJson(!range.empty, "Unicode sequence must be '\\uXXXX'."); + enforceJson(!range.empty, "Unicode sequence must be '\\uXXXX'.", filename, line); auto dc = range.front; range.popFront(); if( dc >= '0' && dc <= '9' ) uch += dc - '0'; else if( dc >= 'a' && dc <= 'f' ) uch += dc - 'a' + 10; else if( dc >= 'A' && dc <= 'F' ) uch += dc - 'A' + 10; - else enforceJson(false, "Unicode sequence must be '\\uXXXX'."); + else enforceJson(false, "Unicode sequence must be '\\uXXXX'.", filename, line); } return uch; } @@ -2001,7 +2001,7 @@ /* surrogate pair */ range.popFront(); // backslash '\' auto uch2 = decode_unicode_escape(); - enforceJson(0xDC00 <= uch2 && uch2 <= 0xDFFF, "invalid Unicode"); + enforceJson(0xDC00 <= uch2 && uch2 <= 0xDFFF, "invalid Unicode", filename, line); { /* valid second surrogate */ uch = @@ -2024,7 +2024,7 @@ } /// private -private string skipNumber(R)(ref R s, out bool is_float) +private string skipNumber(R)(ref R s, out bool is_float, string filename, int* line) { // TODO: make this work with input ranges size_t idx = 0; @@ -2032,7 +2032,7 @@ if (s[idx] == '-') idx++; if (s[idx] == '0') idx++; else { - enforceJson(isDigit(s[idx++]), "Digit expected at beginning of number."); + enforceJson(isDigit(s[idx++]), "Digit expected at beginning of number.", filename, line); while( idx < s.length && isDigit(s[idx]) ) idx++; } @@ -2046,7 +2046,7 @@ idx++; is_float = true; if( idx < s.length && (s[idx] == '+' || s[idx] == '-') ) idx++; - enforceJson( idx < s.length && isDigit(s[idx]), "Expected exponent." ~ s[0 .. idx]); + enforceJson( idx < s.length && isDigit(s[idx]), "Expected exponent." ~ s[0 .. idx], filename, line); idx++; while( idx < s.length && isDigit(s[idx]) ) idx++; } @@ -2057,13 +2057,13 @@ } /// private -private string skipJsonString(R)(ref R s, int* line = null) +private string skipJsonString(R)(ref R s, string filename, int* line) { // TODO: count or disallow any newlines inside of the string - enforceJson(!s.empty && s.front == '"', "Expected '\"' to start string."); + enforceJson(!s.empty && s.front == '"', "Expected '\"' to start string.", filename, line); s.popFront(); - string ret = jsonUnescape(s); - enforceJson(!s.empty && s.front == '"', "Expected '\"' to terminate string."); + string ret = jsonUnescape(s, filename, line); + enforceJson(!s.empty && s.front == '"', "Expected '\"' to terminate string.", filename, line); s.popFront(); return ret; } diff -Nru dub-1.1.1/source/dub/internal/vibecompat/data/serialization.d dub-1.2.0/source/dub/internal/vibecompat/data/serialization.d --- dub-1.1.1/source/dub/internal/vibecompat/data/serialization.d 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/source/dub/internal/vibecompat/data/serialization.d 2017-01-24 21:41:58.000000000 +0000 @@ -91,7 +91,7 @@ */ module dub.internal.vibecompat.data.serialization; -version (Have_vibe_d) public import vibe.data.serialization; +version (Have_vibe_d_data) public import vibe.data.serialization; else: import dub.internal.vibecompat.data.utils; diff -Nru dub-1.1.1/source/dub/internal/vibecompat/data/utils.d dub-1.2.0/source/dub/internal/vibecompat/data/utils.d --- dub-1.1.1/source/dub/internal/vibecompat/data/utils.d 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/source/dub/internal/vibecompat/data/utils.d 2017-01-24 21:41:58.000000000 +0000 @@ -7,7 +7,7 @@ */ module dub.internal.vibecompat.data.utils; -version (Have_vibe_d) {} +version (Have_vibe_d_data) {} else: public import std.traits; diff -Nru dub-1.1.1/source/dub/internal/vibecompat/inet/path.d dub-1.2.0/source/dub/internal/vibecompat/inet/path.d --- dub-1.1.1/source/dub/internal/vibecompat/inet/path.d 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/source/dub/internal/vibecompat/inet/path.d 2017-01-24 21:41:58.000000000 +0000 @@ -7,7 +7,7 @@ */ module dub.internal.vibecompat.inet.path; -version (Have_vibe_d) public import vibe.inet.path; +version (Have_vibe_d_inet) public import vibe.inet.path; else: import std.algorithm; diff -Nru dub-1.1.1/source/dub/internal/vibecompat/inet/url.d dub-1.2.0/source/dub/internal/vibecompat/inet/url.d --- dub-1.1.1/source/dub/internal/vibecompat/inet/url.d 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/source/dub/internal/vibecompat/inet/url.d 2017-01-24 21:41:58.000000000 +0000 @@ -9,7 +9,7 @@ public import dub.internal.vibecompat.inet.path; -version (Have_vibe_d) public import vibe.inet.url; +version (Have_vibe_d_inet) public import vibe.inet.url; else: import std.algorithm; diff -Nru dub-1.1.1/source/dub/package_.d dub-1.2.0/source/dub/package_.d --- dub-1.1.1/source/dub/package_.d 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/source/dub/package_.d 2017-01-24 21:41:58.000000000 +0000 @@ -674,14 +674,22 @@ } } - private void simpleLint() const { + private void simpleLint() + const { if (m_parentPackage) { if (m_parentPackage.path != path) { if (this.recipe.license.length && this.recipe.license != m_parentPackage.recipe.license) - logWarn("License in subpackage %s is different than it's parent package, this is discouraged.", name); + logWarn("Warning: License in subpackage %s is different than it's parent package, this is discouraged.", name); } } - if (name.empty) logWarn("The package in %s has no name.", path); + if (name.empty) logWarn("Warning: The package in %s has no name.", path); + bool[string] cnames; + foreach (ref c; this.recipe.configurations) { + if (c.name in cnames) + logWarn("Warning: Multiple configurations with the name \"%s\" are defined in package \"%s\". This will most likely cause configuration resolution issues.", + c.name, this.name); + cnames[c.name] = true; + } } } diff -Nru dub-1.1.1/source/dub/packagemanager.d dub-1.2.0/source/dub/packagemanager.d --- dub-1.1.1/source/dub/packagemanager.d 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/source/dub/packagemanager.d 2017-01-24 21:41:58.000000000 +0000 @@ -104,7 +104,7 @@ foreach (ovr; m_repositories[tp].overrides) if (ovr.package_ == name && ovr.version_.matches(ver)) { Package pack; - if (!ovr.targetPath.empty) pack = getPackage(name, ovr.targetPath); + if (!ovr.targetPath.empty) pack = getOrLoadPackage(ovr.targetPath); else pack = getPackage(name, ovr.targetVersion, false); if (pack) return pack; @@ -415,7 +415,7 @@ } /// Removes the given the package. - void remove(in Package pack, bool force_remove) + void remove(in Package pack) { logDebug("Remove %s, version %s, path '%s'", pack.name, pack.version_, pack.path); enforce(!pack.path.empty, "Cannot remove package "~pack.name~" without a path."); @@ -445,6 +445,12 @@ logInfo("Removed package: '"~pack.name~"'"); } + /// Compatibility overload. Use the version without a `force_remove` argument instead. + void remove(in Package pack, bool force_remove) + { + remove(pack); + } + Package addLocalPackage(Path path, string verName, LocalPackageType type) { path.endsWithSlash = true; diff -Nru dub-1.1.1/source/dub/platform.d dub-1.2.0/source/dub/platform.d --- dub-1.1.1/source/dub/platform.d 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/source/dub/platform.d 2017-01-24 21:41:58.000000000 +0000 @@ -181,7 +181,7 @@ } if (platform.compiler == splitted.front) { splitted.popFront(); - enforce(splitted.empty, "No valid specification! The compiler has to be the last element!"); + enforce(splitted.empty, "No valid specification! The compiler has to be the last element: " ~ specification); return true; } return false; diff -Nru dub-1.1.1/source/dub/project.d dub-1.2.0/source/dub/project.d --- dub-1.1.1/source/dub/project.d 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/source/dub/project.d 2017-01-24 21:41:58.000000000 +0000 @@ -51,6 +51,7 @@ Package[][Package] m_dependees; SelectedVersions m_selections; bool m_hasAllDependencies; + string[string] m_overriddenConfigs; } /** Loads a project. @@ -208,6 +209,27 @@ return cfgs[m_rootPackage.name]; } + /** Overrides the configuration chosen for a particular package in the + dependency graph. + + Setting a certain configuration here is equivalent to removing all + but one configuration from the package. + + Params: + package_ = The package for which to force selecting a certain + dependency + config = Name of the configuration to force + */ + void overrideConfiguration(string package_, string config) + { + auto p = getDependency(package_, true); + enforce(p !is null, + format("Package '%s', marked for configuration override, is not present in dependency graph.", package_)); + enforce(p.configurations.canFind(config), + format("Package '%s' does not have a configuration named '%s'.", package_, config)); + m_overriddenConfigs[package_] = config; + } + /** Performs basic validation of various aspects of the package. This will emit warnings to `stderr` if any discouraged names or @@ -325,7 +347,7 @@ if (!p && !vspec.path.empty) { Path path = vspec.path; if (!path.absolute) path = pack.path ~ path; - logDiagnostic("%sAdding local %s", indent, path); + logDiagnostic("%sAdding local %s in %s", indent, dep.name, path); p = m_packageManager.getOrLoadPackage(path, Path.init, true); if (p.parentPackage !is null) { logWarn("%sSub package %s must be referenced using the path to it's parent package.", indent, dep.name); @@ -377,11 +399,11 @@ foreach (d; p.getAllDependencies()) parents[d.name] ~= p.name; - size_t createConfig(string pack, string config) { foreach (i, v; configs) if (v.pack == pack && v.config == config) return i; + assert(pack !in m_overriddenConfigs || config == m_overriddenConfigs[pack]); logDebug("Add config %s %s", pack, config); configs ~= Vertex(pack, config); return configs.length-1; @@ -401,12 +423,26 @@ void removeConfig(size_t i) { logDebug("Eliminating config %s for %s", configs[i].config, configs[i].pack); - configs = configs.remove(i); - edges = edges.filter!(e => e.from != i && e.to != i).array(); - foreach (ref e; edges) { - if (e.from > i) e.from--; - if (e.to > i) e.to--; - } + auto had_dep_to_pack = new bool[configs.length]; + auto still_has_dep_to_pack = new bool[configs.length]; + + edges = edges.filter!((e) { + if (e.to == i) { + had_dep_to_pack[e.from] = true; + return false; + } else if (configs[e.to].pack == configs[i].pack) { + still_has_dep_to_pack[e.from] = true; + } + if (e.from == i) return false; + return true; + }).array; + + configs[i] = Vertex.init; // mark config as removed + + // also remove any configs that cannot be satisfied anymore + foreach (j; 0 .. configs.length) + if (j != i && had_dep_to_pack[j] && !still_has_dep_to_pack[j]) + removeConfig(j); } bool isReachable(string pack, string conf) { @@ -430,6 +466,39 @@ } string[] allconfigs_path; + + void determineDependencyConfigs(in Package p, string c) + { + string[][string] depconfigs; + foreach (d; p.getAllDependencies()) { + auto dp = getDependency(d.name, true); + if (!dp) continue; + + string[] cfgs; + if (auto pc = dp.name in m_overriddenConfigs) cfgs = [*pc]; + else { + auto subconf = p.getSubConfiguration(c, dp, platform); + if (!subconf.empty) cfgs = [subconf]; + else cfgs = dp.getPlatformConfigurations(platform); + } + cfgs = cfgs.filter!(c => haveConfig(d.name, c)).array; + + // if no valid configuration was found for a dependency, don't include the + // current configuration + if (!cfgs.length) { + logDebug("Skip %s %s (missing configuration for %s)", p.name, c, dp.name); + return; + } + depconfigs[d.name] = cfgs; + } + + // add this configuration to the graph + size_t cidx = createConfig(p.name, c); + foreach (d; p.getAllDependencies()) + foreach (sc; depconfigs.get(d.name, null)) + createEdge(cidx, createConfig(d.name, sc)); + } + // create a graph of all possible package configurations (package, config) -> (subpackage, subconfig) void determineAllConfigs(in Package p) { @@ -446,33 +515,11 @@ } // for each configuration, determine the configurations usable for the dependencies - outer: foreach (c; p.getPlatformConfigurations(platform, p is m_rootPackage && allow_non_library)) { - string[][string] depconfigs; - foreach (d; p.getAllDependencies()) { - auto dp = getDependency(d.name, true); - if (!dp) continue; - - string[] cfgs; - auto subconf = p.getSubConfiguration(c, dp, platform); - if (!subconf.empty) cfgs = [subconf]; - else cfgs = dp.getPlatformConfigurations(platform); - cfgs = cfgs.filter!(c => haveConfig(d.name, c)).array; - - // if no valid configuration was found for a dependency, don't include the - // current configuration - if (!cfgs.length) { - logDebug("Skip %s %s (missing configuration for %s)", p.name, c, dp.name); - continue outer; - } - depconfigs[d.name] = cfgs; - } - - // add this configuration to the graph - size_t cidx = createConfig(p.name, c); - foreach (d; p.getAllDependencies()) - foreach (sc; depconfigs.get(d.name, null)) - createEdge(cidx, createConfig(d.name, sc)); - } + if (auto pc = p.name in m_overriddenConfigs) + determineDependencyConfigs(p, *pc); + else + foreach (c; p.getPlatformConfigurations(platform, p is m_rootPackage && allow_non_library)) + determineDependencyConfigs(p, c); } if (config.length) createConfig(m_rootPackage.name, config); determineAllConfigs(m_rootPackage); @@ -482,26 +529,24 @@ do { // remove all configs that are not reachable by all parent packages changed = false; - for (size_t i = 0; i < configs.length; ) { + foreach (i, ref c; configs) { + if (c == Vertex.init) continue; // ignore deleted configurations if (!isReachableByAllParentPacks(i)) { - logDebug("NOT REACHABLE by (%s):", parents[configs[i].pack]); + logDebug("%s %s NOT REACHABLE by all of (%s):", c.pack, c.config, parents[c.pack]); removeConfig(i); changed = true; - } else i++; + } } // when all edges are cleaned up, pick one package and remove all but one config if (!changed) { foreach (p; getTopologicalPackageList()) { size_t cnt = 0; - for (size_t i = 0; i < configs.length; ) { - if (configs[i].pack == p.name) { - if (++cnt > 1) { - logDebug("NON-PRIMARY:"); - removeConfig(i); - } else i++; - } else i++; - } + foreach (i, ref c; configs) + if (c.pack == p.name && ++cnt > 1) { + logDebug("NON-PRIMARY: %s %s", c.pack, c.config); + removeConfig(i); + } if (cnt > 1) { changed = true; break; @@ -516,6 +561,7 @@ // return the resulting configuration set as an AA string[string] ret; foreach (c; configs) { + if (c == Vertex.init) continue; // ignore deleted configurations assert(ret.get(c.pack, c.config) == c.config, format("Conflicting configurations for %s found: %s vs. %s", c.pack, c.config, ret[c.pack])); logDebug("Using configuration '%s' for %s", c.config, c.pack); ret[c.pack] = c.config; diff -Nru dub-1.1.1/source/dub/version_.d dub-1.2.0/source/dub/version_.d --- dub-1.1.1/source/dub/version_.d 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/source/dub/version_.d 2017-01-24 21:41:58.000000000 +0000 @@ -1,2 +1,2 @@ module dub.version_; -enum dubVersion = "v1.1.1-beta.1"; +enum dubVersion = "v1.2.0"; diff -Nru dub-1.1.1/test/issue1004-override-config/a/a.d dub-1.2.0/test/issue1004-override-config/a/a.d --- dub-1.1.1/test/issue1004-override-config/a/a.d 1970-01-01 00:00:00.000000000 +0000 +++ dub-1.2.0/test/issue1004-override-config/a/a.d 2017-01-24 21:41:58.000000000 +0000 @@ -0,0 +1,5 @@ +module a; + +void test() +{ +} diff -Nru dub-1.1.1/test/issue1004-override-config/a/dub.sdl dub-1.2.0/test/issue1004-override-config/a/dub.sdl --- dub-1.1.1/test/issue1004-override-config/a/dub.sdl 1970-01-01 00:00:00.000000000 +0000 +++ dub-1.2.0/test/issue1004-override-config/a/dub.sdl 2017-01-24 21:41:58.000000000 +0000 @@ -0,0 +1,9 @@ +name "a" + +configuration "fail" { +} + +configuration "success" { + sourceFiles "a.d" + importPaths "." +} diff -Nru dub-1.1.1/test/issue1004-override-config/main/dub.sdl dub-1.2.0/test/issue1004-override-config/main/dub.sdl --- dub-1.1.1/test/issue1004-override-config/main/dub.sdl 1970-01-01 00:00:00.000000000 +0000 +++ dub-1.2.0/test/issue1004-override-config/main/dub.sdl 2017-01-24 21:41:58.000000000 +0000 @@ -0,0 +1,2 @@ +name "main" +dependency "a" version="*" diff -Nru dub-1.1.1/test/issue1004-override-config/main/source/main.d dub-1.2.0/test/issue1004-override-config/main/source/main.d --- dub-1.1.1/test/issue1004-override-config/main/source/main.d 1970-01-01 00:00:00.000000000 +0000 +++ dub-1.2.0/test/issue1004-override-config/main/source/main.d 2017-01-24 21:41:58.000000000 +0000 @@ -0,0 +1,6 @@ +import a; + +void main() +{ + test(); +} diff -Nru dub-1.1.1/test/issue1004-override-config.sh dub-1.2.0/test/issue1004-override-config.sh --- dub-1.1.1/test/issue1004-override-config.sh 1970-01-01 00:00:00.000000000 +0000 +++ dub-1.2.0/test/issue1004-override-config.sh 2017-01-24 21:41:58.000000000 +0000 @@ -0,0 +1,4 @@ +#!/bin/sh + +cd ${CURR_DIR}/issue1004-override-config +${DUB} build --bare main --override-config a/success || exit 1 diff -Nru dub-1.1.1/test/issue1005-configuration-resolution/a/dub.sdl dub-1.2.0/test/issue1005-configuration-resolution/a/dub.sdl --- dub-1.1.1/test/issue1005-configuration-resolution/a/dub.sdl 1970-01-01 00:00:00.000000000 +0000 +++ dub-1.2.0/test/issue1005-configuration-resolution/a/dub.sdl 2017-01-24 21:41:58.000000000 +0000 @@ -0,0 +1,10 @@ +name "a" +dependency "b" version="*" + +configuration "x" { + subConfiguration "b" "x" +} + +configuration "y" { + subConfiguration "b" "y" +} diff -Nru dub-1.1.1/test/issue1005-configuration-resolution/b/dub.sdl dub-1.2.0/test/issue1005-configuration-resolution/b/dub.sdl --- dub-1.1.1/test/issue1005-configuration-resolution/b/dub.sdl 1970-01-01 00:00:00.000000000 +0000 +++ dub-1.2.0/test/issue1005-configuration-resolution/b/dub.sdl 2017-01-24 21:41:58.000000000 +0000 @@ -0,0 +1,7 @@ +name "b" + +configuration "x" { +} + +configuration "y" { +} \ No newline at end of file diff -Nru dub-1.1.1/test/issue1005-configuration-resolution/b/source/b.d dub-1.2.0/test/issue1005-configuration-resolution/b/source/b.d --- dub-1.1.1/test/issue1005-configuration-resolution/b/source/b.d 1970-01-01 00:00:00.000000000 +0000 +++ dub-1.2.0/test/issue1005-configuration-resolution/b/source/b.d 2017-01-24 21:41:58.000000000 +0000 @@ -0,0 +1,3 @@ +module b; + +void foo() {} diff -Nru dub-1.1.1/test/issue1005-configuration-resolution/c/dub.sdl dub-1.2.0/test/issue1005-configuration-resolution/c/dub.sdl --- dub-1.1.1/test/issue1005-configuration-resolution/c/dub.sdl 1970-01-01 00:00:00.000000000 +0000 +++ dub-1.2.0/test/issue1005-configuration-resolution/c/dub.sdl 2017-01-24 21:41:58.000000000 +0000 @@ -0,0 +1,2 @@ +name "c" +dependency "a" version="*" diff -Nru dub-1.1.1/test/issue1005-configuration-resolution/main/dub.sdl dub-1.2.0/test/issue1005-configuration-resolution/main/dub.sdl --- dub-1.1.1/test/issue1005-configuration-resolution/main/dub.sdl 1970-01-01 00:00:00.000000000 +0000 +++ dub-1.2.0/test/issue1005-configuration-resolution/main/dub.sdl 2017-01-24 21:41:58.000000000 +0000 @@ -0,0 +1,6 @@ +name "main" + +dependency "b" version="*" +dependency "c" version="*" + +subConfiguration "b" "y" diff -Nru dub-1.1.1/test/issue1005-configuration-resolution/main/source/app.d dub-1.2.0/test/issue1005-configuration-resolution/main/source/app.d --- dub-1.1.1/test/issue1005-configuration-resolution/main/source/app.d 1970-01-01 00:00:00.000000000 +0000 +++ dub-1.2.0/test/issue1005-configuration-resolution/main/source/app.d 2017-01-24 21:41:58.000000000 +0000 @@ -0,0 +1,6 @@ +import b; + +void main() +{ + foo(); +} diff -Nru dub-1.1.1/test/issue1005-configuration-resolution.sh dub-1.2.0/test/issue1005-configuration-resolution.sh --- dub-1.1.1/test/issue1005-configuration-resolution.sh 1970-01-01 00:00:00.000000000 +0000 +++ dub-1.2.0/test/issue1005-configuration-resolution.sh 2017-01-24 21:41:58.000000000 +0000 @@ -0,0 +1,4 @@ +#!/bin/sh + +cd ${CURR_DIR}/issue1005-configuration-resolution +${DUB} build --bare main || exit 1 diff -Nru dub-1.1.1/test/issue1024-selective-upgrade/a-1.0.0/dub.sdl dub-1.2.0/test/issue1024-selective-upgrade/a-1.0.0/dub.sdl --- dub-1.1.1/test/issue1024-selective-upgrade/a-1.0.0/dub.sdl 1970-01-01 00:00:00.000000000 +0000 +++ dub-1.2.0/test/issue1024-selective-upgrade/a-1.0.0/dub.sdl 2017-01-24 21:41:58.000000000 +0000 @@ -0,0 +1,2 @@ +name "a" +version "1.0.0" diff -Nru dub-1.1.1/test/issue1024-selective-upgrade/a-1.0.1/dub.sdl dub-1.2.0/test/issue1024-selective-upgrade/a-1.0.1/dub.sdl --- dub-1.1.1/test/issue1024-selective-upgrade/a-1.0.1/dub.sdl 1970-01-01 00:00:00.000000000 +0000 +++ dub-1.2.0/test/issue1024-selective-upgrade/a-1.0.1/dub.sdl 2017-01-24 21:41:58.000000000 +0000 @@ -0,0 +1,2 @@ +name "a" +version "1.0.1" diff -Nru dub-1.1.1/test/issue1024-selective-upgrade/b-1.0.0/dub.sdl dub-1.2.0/test/issue1024-selective-upgrade/b-1.0.0/dub.sdl --- dub-1.1.1/test/issue1024-selective-upgrade/b-1.0.0/dub.sdl 1970-01-01 00:00:00.000000000 +0000 +++ dub-1.2.0/test/issue1024-selective-upgrade/b-1.0.0/dub.sdl 2017-01-24 21:41:58.000000000 +0000 @@ -0,0 +1,2 @@ +name "b" +version "1.0.0" diff -Nru dub-1.1.1/test/issue1024-selective-upgrade/b-1.0.1/dub.sdl dub-1.2.0/test/issue1024-selective-upgrade/b-1.0.1/dub.sdl --- dub-1.1.1/test/issue1024-selective-upgrade/b-1.0.1/dub.sdl 1970-01-01 00:00:00.000000000 +0000 +++ dub-1.2.0/test/issue1024-selective-upgrade/b-1.0.1/dub.sdl 2017-01-24 21:41:58.000000000 +0000 @@ -0,0 +1,2 @@ +name "b" +version "1.0.1" diff -Nru dub-1.1.1/test/issue1024-selective-upgrade/main/dub.sdl dub-1.2.0/test/issue1024-selective-upgrade/main/dub.sdl --- dub-1.1.1/test/issue1024-selective-upgrade/main/dub.sdl 1970-01-01 00:00:00.000000000 +0000 +++ dub-1.2.0/test/issue1024-selective-upgrade/main/dub.sdl 2017-01-24 21:41:58.000000000 +0000 @@ -0,0 +1,3 @@ +name "test" +dependency "a" version="~>1.0.0" +dependency "b" version="~>1.0.0" diff -Nru dub-1.1.1/test/issue1024-selective-upgrade.sh dub-1.2.0/test/issue1024-selective-upgrade.sh --- dub-1.1.1/test/issue1024-selective-upgrade.sh 1970-01-01 00:00:00.000000000 +0000 +++ dub-1.2.0/test/issue1024-selective-upgrade.sh 2017-01-24 21:41:58.000000000 +0000 @@ -0,0 +1,15 @@ +#!/bin/sh + +cd ${CURR_DIR}/issue1024-selective-upgrade +echo "{\"fileVersion\": 1,\"versions\": {\"a\": \"1.0.0\", \"b\": \"1.0.0\"}}" > main/dub.selections.json +$DUB upgrade --bare --root=main a || exit 1 + +if ! grep -c -e "\"a\": \"1.0.1\"" main/dub.selections.json; then + echo "Specified dependency was not upgraded." + exit 1 +fi + +if grep -c -e "\"b\": \"1.0.1\"" main/dub.selections.json; then + echo "Non-specified dependency got upgraded." + exit 1 +fi diff -Nru dub-1.1.1/.travis.yml dub-1.2.0/.travis.yml --- dub-1.1.1/.travis.yml 2016-12-22 18:17:06.000000000 +0000 +++ dub-1.2.0/.travis.yml 2017-01-24 21:41:58.000000000 +0000 @@ -21,7 +21,7 @@ env: [FRONTEND=2.066] - d: dmd-2.065.0 env: [FRONTEND=2.065] - - d: ldc-1.1.0-beta3 + - d: ldc-1.1.0-beta6 env: [FRONTEND=2.071] - d: ldc-1.0.0 env: [FRONTEND=2.070] @@ -40,7 +40,7 @@ - d: gdc-4.9.0 env: [FRONTEND=2.065] allow_failures: - - d: ldc-1.1.0-beta3 + - d: ldc-1.1.0-beta6 script: - ./travis-ci.sh