diff --git a/CHANGELOG.md b/CHANGELOG.md index 2448035..5b3d2e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ Changelog ========= -v0.9.22 - 2014-07- +v0.9.22 - 2014-09-22 -------------------- ### Features and improvements ### @@ -45,6 +45,11 @@ - Using `executeShell` when invoking tools to enable more flexible use of shell features - [issue #356][issue356] - `dub init` now creates a default `.gitignore` file - An exit code of `-9` for a tool now triggers a short message with a possible cause (out of memory) + - The information about possible package upgrades is now cached for one day, resulting in less online queries to the package registry + - Implemented separate compile/link mode for GDC (by Mathias Lang aka Geod24) - [pull #367][issue367] + - `.def` files are now passed to the linking stage when doing separate compile/link building + - Added BASH shell completion script (by Per Nordlöw) - [issue #154][issue154] + - Added FISH shell completion script (by Matt Soucy) - [pull #375][issue375] ### Bug fixes ### @@ -73,9 +78,20 @@ - Fixed up-to-date checking for embedded sub packages (by sinkuu) - [pull #336][issue336] - Fixed outputting multiple instances of the same platform flag which broke the build for some compilers - [issue #346][issue346] - Fixed referencing path based sub packages - [issue #347][issue347] + - Fixed various error messages (by p0nce and sinkuu) - [pull #368][issue368], [pull #376][issue376] + - Fixed the "ddox" build mode when DDOX hasn't already been installed - [issue #366][issue366] + - Fixed probing the compiler for platfrom identifiers when performing cross compiling (by Mathias Lang aka Geod24) - [pull #380][issue380] + - Fixed erroneously dropping the `"buildTypes"` field of downloaded packages (by sinkuu) - [pull #406][issue406] + - Fixed trying to copy files with the same source and destination + - Fixed downloading of packages with "+" in their version - [issue #411][issue411] + - Fixed building dependencies with versions containing "+" on Windows/OPTLINK + - Fixed a crash when sub packages of non-installed base packages are references - [issue #398][issue398] + - Fixed repeated download of base packages when a non-existent sub package is referenced + - Fixed intermediate build path for `--compiler=` binaries speficied with path separators - [issue #412][issue412] [issue134]: https://github.com/rejectedsoftware/dub/issues/134 [issue144]: https://github.com/rejectedsoftware/dub/issues/144 +[issue154]: https://github.com/rejectedsoftware/dub/issues/154 [issue177]: https://github.com/rejectedsoftware/dub/issues/177 [issue185]: https://github.com/rejectedsoftware/dub/issues/185 [issue221]: https://github.com/rejectedsoftware/dub/issues/221 @@ -111,6 +127,16 @@ [issue347]: https://github.com/rejectedsoftware/dub/issues/347 [issue356]: https://github.com/rejectedsoftware/dub/issues/356 [issue364]: https://github.com/rejectedsoftware/dub/issues/364 +[issue366]: https://github.com/rejectedsoftware/dub/issues/366 +[issue367]: https://github.com/rejectedsoftware/dub/issues/367 +[issue368]: https://github.com/rejectedsoftware/dub/issues/368 +[issue375]: https://github.com/rejectedsoftware/dub/issues/375 +[issue376]: https://github.com/rejectedsoftware/dub/issues/376 +[issue380]: https://github.com/rejectedsoftware/dub/issues/380 +[issue398]: https://github.com/rejectedsoftware/dub/issues/398 +[issue406]: https://github.com/rejectedsoftware/dub/issues/406 +[issue411]: https://github.com/rejectedsoftware/dub/issues/411 +[issue412]: https://github.com/rejectedsoftware/dub/issues/412 v0.9.21 - 2014-02-22 diff --git a/dub.json b/dub.json index 3d5c3a3..44a38a9 100644 --- a/dub.json +++ b/dub.json @@ -14,7 +14,6 @@ "targetType": "executable", "mainSourceFile": "source/app.d", "libs": ["curl"], - "copyFiles-windows": ["curllib.dll", "libeay32.dll", "openldap.dll", "ssleay32.dll"], "versions": ["DubUseCurl"] }, { @@ -22,7 +21,7 @@ "targetType": "library", "excludedSourceFiles": ["source/app.d"], "libs": ["curl"], - "copyFiles-windows": ["curllib.dll", "libeay32.dll", "openldap.dll", "ssleay32.dll"], + "copyFiles-windows": ["bin/libcurl.dll", "bin/libeay32.dll", "bin/ssleay32.dll"], "versions": ["DubUseCurl"] }, { diff --git a/source/dub/dependency.d b/source/dub/dependency.d index 58622f1..90d5e4e 100644 --- a/source/dub/dependency.d +++ b/source/dub/dependency.d @@ -141,6 +141,8 @@ const { string r; + if (this == invalid) return "invalid"; + if( m_versA == m_versB && m_cmpA == ">=" && m_cmpB == "<=" ){ // Special "==" case if (m_versA == Version.MASTER ) r = "~master"; diff --git a/source/dub/dependencyresolver.d b/source/dub/dependencyresolver.d index cd9ef17..36804a0 100644 --- a/source/dub/dependencyresolver.d +++ b/source/dub/dependencyresolver.d @@ -10,8 +10,8 @@ import dub.dependency; import dub.internal.vibecompat.core.log; -import std.algorithm : all, canFind, sort; -import std.array : appender; +import std.algorithm : all, canFind, filter, sort; +import std.array : appender, array; import std.conv : to; import std.exception : enforce; import std.string : format, indexOf, lastIndexOf; @@ -66,7 +66,7 @@ size_t[string] package_indices; CONFIG[][] all_configs; bool[TreeNode] visited; - void findConfigsRec(TreeNode parent) + void findConfigsRec(TreeNode parent, bool parent_unique) { if (parent in visited) return; visited[parent] = true; @@ -87,13 +87,17 @@ configs = getSpecificConfigs(ch) ~ configs; + // eliminate configurations from which we know that they can't satisfy + // the uniquely defined root dependencies (==version or ~branch style dependencies) + if (parent_unique) configs = configs.filter!(c => matches(ch.configs, c)).array; + all_configs[pidx] = configs; foreach (v; configs) - findConfigsRec(TreeNode(ch.pack, v)); + findConfigsRec(TreeNode(ch.pack, v), parent_unique && configs.length == 1); } } - findConfigsRec(root); + findConfigsRec(root, true); // prepend an invalid configuration to denote an unchosen dependency // this is used to properly support optional dependencies (when @@ -128,7 +132,7 @@ // get the current config/version of the current dependency sizediff_t childidx = package_indices[basepack]; - if (!all_configs[childidx].length) { + if (all_configs[childidx] == [CONFIG.invalid]) { enforce(parentbase != root_base_pack, format("Root package %s contains reference to invalid package %s", parent.pack, ch.pack)); // choose another parent config to avoid the invalid child if (parentidx > maxcpi) { @@ -139,7 +143,7 @@ } else { auto config = all_configs[childidx][config_indices[childidx]]; auto chnode = TreeNode(ch.pack, config); - + if (config == CONFIG.invalid || !matches(ch.configs, config)) { // if we are at the root level, we can safely skip the maxcpi computation and instead choose another childidx config if (parentbase == root_base_pack) { @@ -152,10 +156,13 @@ error = format("Dependency %s -> %s %s mismatches with selected version %s", parent.pack, ch.pack, ch.configs, config); logDebug("%s (ci=%s)", error, maxcpi); } + + // we know that either the child or the parent needs to be switched + // to another configuration, no need to continue with other children + if (config == CONFIG.invalid) break; } - if (config != CONFIG.invalid) - maxcpi = max(maxcpi, validateConfigs(chnode, error)); + maxcpi = max(maxcpi, validateConfigs(chnode, error)); } } return maxcpi; diff --git a/source/dub/dub.d b/source/dub/dub.d index 6971959..3ffd4e5 100644 --- a/source/dub/dub.d +++ b/source/dub/dub.d @@ -487,6 +487,7 @@ logInfo("Placing %s %s to %s...", packageId, ver, placement.toNativeString()); auto clean_package_version = ver[ver.startsWith("~") ? 1 : 0 .. $]; + clean_package_version = clean_package_version.replace("+", "_"); // + has special meaning for Optlink Path dstpath = placement ~ (packageId ~ "-" ~ clean_package_version); return m_packageManager.storeFetchedPackage(tempFile, pinfo, dstpath); @@ -711,16 +712,16 @@ } /** - * Search for module keyword in D Code + * Search for module keyword in D Code */ string getModuleNameFromContent(string content) { import std.regex; auto commentsPattern = ctRegex!(`(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)|(//.*)`, "g"); auto modulePattern = ctRegex!(`module\s+([\w\.]+)\s*;`, "g"); - + content = replaceAll(content, commentsPattern, ""); - string moduleName = matchFirst(content, modulePattern).front; + string moduleName = matchFirst(content, modulePattern).front; if(moduleName.length >= 7) moduleName = moduleName[7..$-1]; @@ -732,29 +733,29 @@ //test simple name string name = getModuleNameFromContent("module myPackage.myModule;"); assert(name == "myPackage.myModule", "can't parse module name"); - + //test if it can ignore module inside comments name = getModuleNameFromContent("/** module fakePackage.fakeModule; */ module myPackage.myModule;"); - + assert(name == "myPackage.myModule", "can't parse module name"); - + name = getModuleNameFromContent("//module fakePackage.fakeModule; module myPackage.myModule;"); - + assert(name == "myPackage.myModule", "can't parse module name"); } /** - * Search for module keyword in file + * Search for module keyword in file */ string getModuleNameFromFile(string filePath) { string fileContent = filePath.readText; - + return getModuleNameFromContent(fileContent); -} +} enum UpgradeOptions { @@ -896,12 +897,18 @@ if (basename != name) { auto subname = getSubPackageName(name); auto basepack = getPackage(basename, dep); + if (!basepack) return null; if (auto sp = m_dub.m_packageManager.getSubPackage(basepack, subname, true)) { return sp; } else if (!basepack.subPackages.canFind!(p => p.path.length)) { // note: external sub packages are handled further below logDiagnostic("Sub package %s doesn't exist in %s %s.", name, basename, dep.version_); return null; + } else if (auto ret = m_dub.m_packageManager.getBestPackage(name, dep)) { + return ret; + } else { + logDiagnostic("External sub package %s %s not found.", name, dep.version_); + return null; } } @@ -929,7 +936,7 @@ m_remotePackages[key] = ret; return ret; } catch (Exception e) { - logDiagnostic("Metadata for %s could not be downloaded from %s: %s", name, ps.description, e.msg); + logDiagnostic("Metadata for %s %s could not be downloaded from %s: %s", name, dep, ps.description, e.msg); logDebug("Full error: %s", e.toString().sanitize); } } else { @@ -955,7 +962,7 @@ m_remotePackages[key] = null; - logWarn("Package %s %s was found neither locally, nor in the configured package registries.", name, dep); + logWarn("Package %s %s could not be loaded either locally, or from the configured package registries.", name, dep); return null; } } diff --git a/source/dub/generators/build.d b/source/dub/generators/build.d index 57de118..526087e 100644 --- a/source/dub/generators/build.d +++ b/source/dub/generators/build.d @@ -165,8 +165,8 @@ mainsrc = Path(buildsettings.mainSourceFile); if (!mainsrc.absolute) mainsrc = pack.path ~ mainsrc; } else { - logWarn(`Package has no "mainSourceFile" defined. Trying to guess something to pass to RDMD...`); mainsrc = getMainSourceFile(pack); + logWarn(`Package has no "mainSourceFile" defined. Using best guess: %s`, mainsrc.relativeTo(pack.path).toNativeString()); } // do not pass all source files to RDMD, only the main source file @@ -290,14 +290,15 @@ addHash((cast(uint)buildsettings.options).to!string); addHash(buildsettings.stringImportPaths); addHash(settings.platform.architecture); + addHash(settings.platform.compilerBinary); addHash(settings.platform.compiler); addHashI(settings.platform.frontendVersion); auto hashstr = hash.finish().toHexString().idup; - return format("%s-%s-%s-%s-%s-%s", config, settings.buildType, + return format("%s-%s-%s-%s-%s_%s-%s", config, settings.buildType, settings.platform.platform.join("."), settings.platform.architecture.join("."), - settings.platform.compiler, hashstr); + settings.platform.compiler, settings.platform.frontendVersion, hashstr); } private void copyTargetFile(Path build_path, BuildSettings buildsettings, BuildPlatform platform) diff --git a/source/dub/generators/generator.d b/source/dub/generators/generator.d index 8184818..db64ef1 100644 --- a/source/dub/generators/generator.d +++ b/source/dub/generators/generator.d @@ -283,10 +283,14 @@ auto src = Path(file); if (!src.absolute) src = pack_path ~ src; auto dst = target_path ~ Path(file).head; + if (src == dst) { + logDiagnostic("Skipping copy of %s (same source and destination)", file); + return; + } logDiagnostic(" %s to %s", src.toNativeString(), dst.toNativeString()); try { copyFile(src, dst, true); - } catch logWarn("Failed to copy %s to %s", src.toNativeString(), dst.toNativeString()); + } catch(Exception e) logWarn("Failed to copy %s to %s: %s", src.toNativeString(), dst.toNativeString(), e.msg); } logInfo("Copying files for %s...", pack); string[] globs; diff --git a/source/dub/internal/vibecompat/core/file.d b/source/dub/internal/vibecompat/core/file.d index e6849fe..7ac4008 100644 --- a/source/dub/internal/vibecompat/core/file.d +++ b/source/dub/internal/vibecompat/core/file.d @@ -104,6 +104,8 @@ */ void copyFile(Path from, Path to, bool overwrite = false) { + enforce(existsFile(from), "Source file does not exist."); + if (existsFile(to)) { enforce(overwrite, "Destination file already exists."); // remove file before copy to allow "overwriting" files that are in diff --git a/source/dub/package_.d b/source/dub/package_.d index d2ccc23..25f412c 100644 --- a/source/dub/package_.d +++ b/source/dub/package_.d @@ -108,7 +108,9 @@ // parse the Package description if(raw_package !is null) { - scope(failure) logError("Failed to parse package description in %s", root.toNativeString()); + scope(failure) logError("Failed to parse package description for %s %s in %s.", + raw_package.package_name, versionOverride.length ? versionOverride : raw_package.version_, + root.length ? root.toNativeString() : "remote location"); raw_package.parseInto(recipe, parent ? parent.name : null); if (!versionOverride.empty) diff --git a/source/dub/packagesupplier.d b/source/dub/packagesupplier.d index 2f6ae81..475a459 100644 --- a/source/dub/packagesupplier.d +++ b/source/dub/packagesupplier.d @@ -141,7 +141,7 @@ { import std.array : replace; Json best = getBestPackage(packageId, dep, pre_release); - auto vers = replace(best["version"].get!string, "+", "%2B"); + auto vers = best["version"].get!string; auto url = m_registryUrl ~ Path(PackagesPath~"/"~packageId~"/"~vers~".zip"); logDiagnostic("Found download URL: '%s'", url); download(url, path); diff --git a/source/dub/version_.d b/source/dub/version_.d index cac04d3..74d8e3f 100644 --- a/source/dub/version_.d +++ b/source/dub/version_.d @@ -1 +1 @@ -module dub.version_; enum dubVersion = "v0.9.21"; +module dub.version_; enum dubVersion = "v0.9.22";