diff --git a/.github/issue_template.md b/.github/issue_template.md new file mode 100644 index 0000000..b63759d --- /dev/null +++ b/.github/issue_template.md @@ -0,0 +1,17 @@ +Please search for existing solutions to your problem. +- Issue list: https://github.com/dlang/dub/issues?q=is%3Aissue +- Cookbook: https://github.com/dlang/dub/wiki/Cookbook +- Stack Overflow: https://stackoverflow.com/questions/tagged/dub + +### System information +- **dub version** (e.g. dub 1.3.0) +- **OS Platform and distribution** (e.g. Windows 10, Linux Ubuntu 16.04) +- **compiler version** (e.g. dmd-2.074.1) + +### Bug Description + +### How to reproduce? + +### Expected Behavior + +### Logs diff --git a/.travis.yml b/.travis.yml index 4b4b302..f131df0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,14 @@ matrix: include: + - d: dmd-nightly + env: [FRONTEND=2.074] + - d: dmd-beta + env: [FRONTEND=2.074] + - d: dmd + env: [FRONTEND=2.074] + - d: dmd-2.074.0 + env: [FRONTEND=2.074] - d: dmd-2.073.0 env: - [FRONTEND=2.073] @@ -23,18 +31,20 @@ env: [FRONTEND=2.066] - d: dmd-2.065.0 env: [FRONTEND=2.065] + - d: ldc-beta + env: [FRONTEND=2.073] + - d: ldc + env: [FRONTEND=2.072] + - d: ldc-1.2.0 + env: [FRONTEND=2.072] - d: ldc-1.1.0 env: [FRONTEND=2.071] - d: ldc-1.0.0 env: [FRONTEND=2.070] - d: ldc-0.17.2 env: [FRONTEND=2.068] - - d: ldc-0.16.1 - env: [FRONTEND=2.067] - - d: ldc-0.15.1 - env: [FRONTEND=2.066] - - d: ldc-0.14.0 - env: [FRONTEND=2.065] + - d: gdc + env: [FRONTEND=2.068] - d: gdc-5.2.0 env: [FRONTEND=2.066] - d: gdc-4.9.2 @@ -42,5 +52,8 @@ - d: gdc-4.9.0 env: [FRONTEND=2.065] + allow_failures: + - d: gdc + script: - ./travis-ci.sh diff --git a/README.md b/README.md index 5bff591..f2aa9b7 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ ## Key features - Simple package and build description not getting in your way - - Integrated with Git, avoiding maintainance tasks such as incrementing version numbers or uploading new project releases + - Integrated with Git, avoiding maintenance tasks such as incrementing version numbers or uploading new project releases - Generates VisualD project/solution files, integrated into MonoD - Support for DMD, GDC and LDC (common DMD flags are translated automatically) - Supports development workflows by optionally using local directories as a package source diff --git a/dub.selections.json b/dub.selections.json index f217451..2507d5a 100644 --- a/dub.selections.json +++ b/dub.selections.json @@ -6,6 +6,6 @@ "libevent": "2.0.1+2.0.16", "memutils": "0.4.8", "openssl": "1.1.5+1.0.1g", - "vibe-d": "0.7.30" + "vibe-d": "0.7.31" } } diff --git a/scripts/win-installer/EnvVarUpdate.nsh b/scripts/win-installer/EnvVarUpdate.nsh index b67e3ba..245499b 100644 --- a/scripts/win-installer/EnvVarUpdate.nsh +++ b/scripts/win-installer/EnvVarUpdate.nsh @@ -145,7 +145,7 @@ Goto EnvVarUpdate_Restore_Vars ${EndIf} - ;;khc - here check if length is going to be greater then max string length + ;;khc - here check if length is going to be greater than max string length ;; and abort if so - also abort if original path empty - may mean ;; it was too long as well- write message to say set it by hand diff --git a/source/dub/commandline.d b/source/dub/commandline.d index a391089..3fec92f 100644 --- a/source/dub/commandline.d +++ b/source/dub/commandline.d @@ -478,6 +478,8 @@ } void depCallback(ref PackageRecipe p, ref PackageFormat fmt) { + import std.datetime: Clock; + if (m_nonInteractive) return; while (true) { @@ -491,11 +493,23 @@ } } auto author = p.authors.join(", "); - p.name = input("Name", p.name); + while (true) { + // Tries getting the name until a valid one is given. + import std.regex; + auto nameRegex = regex(`^[a-z\-_]+$`); + string triedName = input("Name", p.name); + if (triedName.matchFirst(nameRegex).empty) { + logError("Invalid name, \""~triedName~"\", names should consist only of lowercase alphanumeric characters, - and _."); + } else { + p.name = triedName; + break; + } + } p.description = input("Description", p.description); p.authors = input("Author name", author).split(",").map!(a => a.strip).array; p.license = input("License", p.license); - p.copyright = input("Copyright string", p.copyright); + string copyrightString = .format("Copyright © %s, %-(%s, %)", Clock.currTime().year, p.authors); + p.copyright = input("Copyright string", copyrightString); while (true) { auto depname = input("Add dependency (leave empty to skip)", null); @@ -1106,7 +1120,7 @@ "Uses the latest pre-release version, even if release versions are available" ]); args.getopt("verify", &m_verify, [ - "Updates the project and performs a build. If successful, rewrites the selected versions file ." + "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." diff --git a/source/dub/compilers/buildsettings.d b/source/dub/compilers/buildsettings.d index 9826ea1..beebd0f 100644 --- a/source/dub/compilers/buildsettings.d +++ b/source/dub/compilers/buildsettings.d @@ -96,7 +96,6 @@ void addStringImportPaths(in string[] value...) { add(stringImportPaths, value); } void prependStringImportPaths(in string[] value...) { prepend(stringImportPaths, value); } void addImportFiles(in string[] value...) { add(importFiles, value); } - void removeImportFiles(in string[] value...) { removePaths(importFiles, value); } void addStringImportFiles(in string[] value...) { addSI(stringImportFiles, value); } void addPreGenerateCommands(in string[] value...) { add(preGenerateCommands, value, false); } void addPostGenerateCommands(in string[] value...) { add(postGenerateCommands, value, false); } diff --git a/source/dub/compilers/dmd.d b/source/dub/compilers/dmd.d index 61ec4a0..0295a64 100644 --- a/source/dub/compilers/dmd.d +++ b/source/dub/compilers/dmd.d @@ -143,9 +143,13 @@ string getTargetFileName(in BuildSettings settings, in BuildPlatform platform) const { + import std.conv: text; assert(settings.targetName.length > 0, "No target name set."); final switch (settings.targetType) { - case TargetType.autodetect: assert(false, "Configurations must have a concrete target type."); + case TargetType.autodetect: + assert(false, + text("Configurations must have a concrete target type, ", settings.targetName, + " has ", settings.targetType)); case TargetType.none: return null; case TargetType.sourceLibrary: return null; case TargetType.executable: @@ -212,7 +216,7 @@ auto args = ["-of"~tpath.toNativeString()]; args ~= objects; args ~= settings.sourceFiles; - version(linux) args ~= "-L--no-as-needed"; // avoids linker errors due to libraries being speficied in the wrong order by DMD + version(linux) args ~= "-L--no-as-needed"; // avoids linker errors due to libraries being specified in the wrong order by DMD args ~= lflagsToDFlags(settings.lflags); args ~= settings.dflags.filter!(f => isLinkerDFlag(f)).array; diff --git a/source/dub/compilers/gdc.d b/source/dub/compilers/gdc.d index bb5def1..7a20f54 100644 --- a/source/dub/compilers/gdc.d +++ b/source/dub/compilers/gdc.d @@ -209,7 +209,7 @@ args = [ "ar", "rcs", tpath ] ~ objects; } else { args = platform.compilerBinary ~ objects ~ settings.sourceFiles ~ settings.lflags ~ settings.dflags.filter!(f => isLinkageFlag(f)).array; - version(linux) args ~= "-L--no-as-needed"; // avoids linker errors due to libraries being speficied in the wrong order by DMD + version(linux) args ~= "-L--no-as-needed"; // avoids linker errors due to libraries being specified in the wrong order by DMD } logDiagnostic("%s", args.join(" ")); invokeTool(args, output_callback); diff --git a/source/dub/compilers/utils.d b/source/dub/compilers/utils.d index 48e312d..218fd87 100644 --- a/source/dub/compilers/utils.d +++ b/source/dub/compilers/utils.d @@ -142,7 +142,7 @@ /** Searches the given list of compiler flags for ones that have a generic equivalent. - Certain compiler flags should, instead of using compiler-specfic syntax, + Certain compiler flags should, instead of using compiler-specific syntax, be specified as build options (`BuildOptions`) or built requirements (`BuildRequirements`). This function will output warning messages to assist the user in making the best choice. @@ -238,7 +238,7 @@ /** - Generate a file that will give, at compile time, informations about the compiler (architecture, frontend version...) + Generate a file that will give, at compile time, information about the compiler (architecture, frontend version...) See_Also: `readPlatformProbe` */ diff --git a/source/dub/dependency.d b/source/dub/dependency.d index fdd9fe6..073ac91 100644 --- a/source/dub/dependency.d +++ b/source/dub/dependency.d @@ -308,7 +308,7 @@ } else { enforce("version" in verspec, "No version field specified!"); auto ver = verspec["version"].get!string; - // Using the string to be able to specifiy a range of versions. + // Using the string to be able to specify a range of versions. dep = Dependency(ver); } @@ -615,7 +615,7 @@ assert(a.merge(b) == b); assert(b.merge(a) == b); - logDebug("Dependency unittest sucess."); + logDebug("Dependency unittest success."); } unittest { diff --git a/source/dub/generators/build.d b/source/dub/generators/build.d index 10d7dee..86ca3e4 100644 --- a/source/dub/generators/build.d +++ b/source/dub/generators/build.d @@ -136,7 +136,7 @@ else cached = performCachedBuild(settings, buildsettings, pack, config, build_id, packages, additional_dep_files, target_path); // HACK: cleanup dummy doc files, we shouldn't specialize on buildType - // here and the compiler shouldn't need dummy doc ouput. + // here and the compiler shouldn't need dummy doc output. if (settings.buildType == "ddox") { if ("__dummy.html".exists) removeFile("__dummy.html"); @@ -159,7 +159,10 @@ auto cwd = Path(getcwd()); Path target_path; - if (settings.tempBuild) m_targetExecutablePath = target_path = getTempDir() ~ format(".dub/build/%s-%s/%s/", pack.name, pack.version_, build_id); + if (settings.tempBuild) { + string packageName = pack.basePackage is null ? pack.name : pack.basePackage.name; + m_targetExecutablePath = target_path = getTempDir() ~ format(".dub/build/%s-%s/%s/", packageName, pack.version_, build_id); + } else target_path = pack.path ~ format(".dub/build/%s/", build_id); if (!settings.force && isUpToDate(target_path, buildsettings, settings, pack, packages, additional_dep_files)) { @@ -203,7 +206,7 @@ private void performRDMDBuild(GeneratorSettings settings, ref BuildSettings buildsettings, in Package pack, string config, out Path target_path) { auto cwd = Path(getcwd()); - //Added check for existance of [AppNameInPackagejson].d + //Added check for existence of [AppNameInPackagejson].d //If exists, use that as the starting file. Path mainsrc; if (buildsettings.mainSourceFile.length) { diff --git a/source/dub/generators/generator.d b/source/dub/generators/generator.d index 7b67e52..7938cc7 100644 --- a/source/dub/generators/generator.d +++ b/source/dub/generators/generator.d @@ -461,7 +461,7 @@ /** Runs a list of build commands for a particular package. - This funtion sets all DUB speficic environment variables and makes sure + This function sets all DUB speficic environment variables and makes sure that recursive dub invocations are detected and don't result in infinite command execution loops. The latter could otherwise happen when a command runs "dub describe" or similar functionality. diff --git a/source/dub/init.d b/source/dub/init.d index 5c590fe..36d68bd 100644 --- a/source/dub/init.d +++ b/source/dub/init.d @@ -13,7 +13,6 @@ import dub.recipe.packagerecipe; import dub.dependency; -import std.datetime; import std.exception; import std.file; import std.format; @@ -21,7 +20,7 @@ import std.string; -/** Intializes a new package in the given directory. +/** Initializes a new package in the given directory. The given `root_path` will be checked for any of the files that will be created by this function. If any exist, an exception will be thrown before @@ -55,7 +54,6 @@ p.name = root_path.head.toString().toLower(); p.authors ~= username; p.license = "proprietary"; - p.copyright = .format("Copyright © %s, %s", Clock.currTime().year, username); foreach (pack, v; deps) { import std.ascii : isDigit; p.buildSettings.dependencies[pack] = Dependency(v); diff --git a/source/dub/internal/sdlang/ast.d b/source/dub/internal/sdlang/ast.d index cf0776c..deda488 100644 --- a/source/dub/internal/sdlang/ast.d +++ b/source/dub/internal/sdlang/ast.d @@ -946,7 +946,7 @@ } /// Access 'attributes', 'tags', 'namespaces' and 'all' like normal, - /// except that looking up a non-existant name/namespace with + /// except that looking up a non-existent name/namespace with /// opIndex(string) results in an empty array instead of a thrown SDLangRangeException. @property MaybeAccess maybe() { diff --git a/source/dub/internal/vibecompat/data/json.d b/source/dub/internal/vibecompat/data/json.d index 4a9bc00..1699f40 100644 --- a/source/dub/internal/vibecompat/data/json.d +++ b/source/dub/internal/vibecompat/data/json.d @@ -265,7 +265,7 @@ m_object[key] = Json.init; assert(m_object !is null); assert(key in m_object, "Failed to insert key '"~key~"' into AA!?"); - m_object[key].m_type = Type.undefined; // DMDBUG: AAs are teh $H1T!!!11 + m_object[key].m_type = Type.undefined; // DMDBUG: AAs are the $H1T!!!11 assert(m_object[key].type == Type.undefined); m_object[key].m_string = key; version (VibeJsonFieldNames) m_object[key].m_name = format("%s.%s", m_name, key); diff --git a/source/dub/packagemanager.d b/source/dub/packagemanager.d index dd0cf40..4ff4e6f 100644 --- a/source/dub/packagemanager.d +++ b/source/dub/packagemanager.d @@ -239,7 +239,7 @@ return isManagedPath(ppath); } - /** Determines if a specifc path is within a DUB managed package folder. + /** Determines if a specific path is within a DUB managed package folder. By default, managed folders are "~/.dub/packages" and "/var/lib/dub/packages". diff --git a/source/dub/recipe/packagerecipe.d b/source/dub/recipe/packagerecipe.d index a5b7609..e76d487 100644 --- a/source/dub/recipe/packagerecipe.d +++ b/source/dub/recipe/packagerecipe.d @@ -27,7 +27,7 @@ Sub qualified package names are lists of package names separated by ":". For example, "packa:packb:packc" references a package named "packc" that is a - sub package of "packb", wich in turn is a sub package of "packa". + sub package of "packb", which in turn is a sub package of "packa". */ string[] getSubPackagePath(string package_name) { @@ -173,7 +173,7 @@ dst.addSourceFiles(this.mainSourceFile); } - void collectFiles(string method)(in string[][string] paths_map, string pattern) + string[] collectFiles(in string[][string] paths_map, string pattern) { auto files = appender!(string[]); @@ -192,24 +192,29 @@ foreach (d; dirEntries(path.toNativeString(), pattern, SpanMode.depth)) { import std.path : baseName; - if (baseName(d.name)[0] == '.' || isDir(d.name)) continue; + if (baseName(d.name)[0] == '.' || d.isDir) continue; auto src = Path(d.name).relativeTo(base_path); files ~= src.toNativeString(); } } } - __traits(getMember, dst, method)(files.data); + return files.data; } - // collect files from all source/import folders - collectFiles!"addSourceFiles"(sourcePaths, "*.d"); - collectFiles!"addImportFiles"(importPaths, "*.{d,di}"); - dst.removeImportFiles(dst.sourceFiles); - collectFiles!"addStringImportFiles"(stringImportPaths, "*"); + // collect source files + dst.addSourceFiles(collectFiles(sourcePaths, "*.d")); + auto sourceFiles = dst.sourceFiles.sort(); - // ensure a deterministic order of files as passed to the compiler - dst.sourceFiles.sort(); + // collect import files and remove sources + import std.algorithm : copy, setDifference; + + auto importFiles = collectFiles(importPaths, "*.{d,di}").sort(); + immutable nremoved = importFiles.setDifference(sourceFiles).copy(importFiles.release).length; + importFiles = importFiles[0 .. $ - nremoved]; + dst.addImportFiles(importFiles.release); + + dst.addStringImportFiles(collectFiles(stringImportPaths, "*")); getPlatformSetting!("dflags", "addDFlags")(dst, platform); getPlatformSetting!("lflags", "addLFlags")(dst, platform); diff --git a/test/0-init-multi-json.sh b/test/0-init-multi-json.sh index 8e0a441..c9fd92d 100755 --- a/test/0-init-multi-json.sh +++ b/test/0-init-multi-json.sh @@ -12,7 +12,7 @@ if [ ! -e $packname/dub.json ]; then # it failed, exit 1 exit 1 -else # check if resulting dub.json has all dependancies in tow +else # check if resulting dub.json has all dependencies in tow deps="$deps vibe-d"; IFS=" " read -a arr <<< "$deps" for ele in "${arr[@]}" diff --git a/test/0-init-multi.sh b/test/0-init-multi.sh index 5f74a3d..a03694e 100755 --- a/test/0-init-multi.sh +++ b/test/0-init-multi.sh @@ -14,7 +14,7 @@ echo "No dub.sdl file has been generated." cleanup exit 1 -else # check if resulting dub.sdl has all dependancies in tow +else # check if resulting dub.sdl has all dependencies in tow deps="$deps vibe-d"; IFS=" " read -a arr <<< "$deps" for ele in "${arr[@]}" diff --git a/test/issue782-gtkd-pkg-config/fake-gtkd/pkgconfig/fake-gtkd.pc b/test/issue782-gtkd-pkg-config/fake-gtkd/pkgconfig/fake-gtkd.pc index 1f06032..654ac32 100644 --- a/test/issue782-gtkd-pkg-config/fake-gtkd/pkgconfig/fake-gtkd.pc +++ b/test/issue782-gtkd-pkg-config/fake-gtkd/pkgconfig/fake-gtkd.pc @@ -6,7 +6,7 @@ Description: Fake GtkD shared library for testing Version: 1.0.0 #Requires: phobos2 -# The "-L-defaultlib=libphobos2.so" and "-defaultlib=libphobos2.so" should both end up on the compiler (at link stage) invokation as "-defaultlib=libphobos2.so" +# The "-L-defaultlib=libphobos2.so" and "-defaultlib=libphobos2.so" should both end up on the compiler (at link stage) invocation as "-defaultlib=libphobos2.so" # For this test, it doesn't hurt that they appear twice on the cmd line... Libs: -L-L${libdir} -L-l:libfake-gtkd.so -L-l:libdl.so.2 -pthread -L-defaultlib=libphobos2.so -defaultlib=libphobos2.so Cflags: -I${includedir} diff --git a/test/run-unittest.sh b/test/run-unittest.sh index b832b0f..deaf166 100755 --- a/test/run-unittest.sh +++ b/test/run-unittest.sh @@ -50,7 +50,7 @@ fi fi - # We run the ones that are supposed to be runned + # We run the ones that are supposed to be ran if [ ! -e $pack/.no_build ] && [ ! -e $pack/.no_run ]; then log "Running $pack..." $DUB run --force --root=$pack --compiler=$DC || logError "Run failure."