diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e66a488..24d2b1b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,9 +69,13 @@ - name: '[Windows] Test' if: runner.os == 'Windows' + env: + DUB: ${{ github.workspace }}\bin\dub.exe # Only run `dub test` to run unittests so far, # the test-suite needs to be overhauled to support Windows run: | dub build --compiler=${{ env.DC }} dub test --compiler=${{ env.DC }} dub run --compiler=${{ env.DC }} --single test\issue2051_running_unittests_from_dub_single_file_packages_fails.d + cd test + dub --single run-unittest.d diff --git a/.gitignore b/.gitignore index 06b77b4..e0ee768 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,8 @@ /test/*/*test-application /test/*/exec-simple /test/issue1474/ext/fortytwo.d +*.exe +*.log # Ignore coverage files cov/ diff --git a/changelog/add_lowmem.dd b/changelog/add_lowmem.dd new file mode 100644 index 0000000..84d7faa --- /dev/null +++ b/changelog/add_lowmem.dd @@ -0,0 +1,9 @@ +Added support for low memory compilation option to the $(LINK2 https://dub.pm/settings, dub settings file). + +To enable, set `defaultLowMemory` to `true`. For dmd and ldc, the `-lowmem` command-line option is added when compiling. + +``` +{ + "defaultLowMemory": true +} +``` diff --git a/source/dub/commandline.d b/source/dub/commandline.d index bebdd43..7a799d2 100644 --- a/source/dub/commandline.d +++ b/source/dub/commandline.d @@ -998,6 +998,7 @@ { if (!m_compilerName.length) m_compilerName = dub.defaultCompiler; if (!m_arch.length) m_arch = dub.defaultArchitecture; + if (dub.defaultLowMemory) m_buildSettings.options |= BuildOption.lowmem; m_compiler = getCompiler(m_compilerName); m_buildPlatform = m_compiler.determinePlatform(m_buildSettings, m_compilerName, m_arch); m_buildSettings.addDebugVersions(m_debugVersions); @@ -1592,6 +1593,7 @@ settings.buildType = m_buildType; settings.compiler = m_compiler; settings.filterVersions = m_filterVersions; + settings.buildSettings.options |= m_buildSettings.options & BuildOption.lowmem; if (m_importPaths) { m_data = ["import-paths"]; m_dataList = true; } else if (m_stringImportPaths) { m_data = ["string-import-paths"]; m_dataList = true; } diff --git a/source/dub/compilers/buildsettings.d b/source/dub/compilers/buildsettings.d index f5bb45f..49965e7 100644 --- a/source/dub/compilers/buildsettings.d +++ b/source/dub/compilers/buildsettings.d @@ -325,10 +325,11 @@ profileGC = 1<<21, /// Profile runtime allocations pic = 1<<22, /// Generate position independent code betterC = 1<<23, /// Compile in betterC mode (-betterC) + lowmem = 1<<24, /// Compile in lowmem mode (-lowmem) // for internal usage - _docs = 1<<24, // Write ddoc to docs - _ddox = 1<<25 // Compile docs.json + _docs = 1<<25, // Write ddoc to docs + _ddox = 1<<26 // Compile docs.json } struct BuildOptions { diff --git a/source/dub/compilers/dmd.d b/source/dub/compilers/dmd.d index 1782831..add0308 100644 --- a/source/dub/compilers/dmd.d +++ b/source/dub/compilers/dmd.d @@ -63,6 +63,7 @@ tuple(BuildOption.property, ["-property"]), tuple(BuildOption.profileGC, ["-profile=gc"]), tuple(BuildOption.betterC, ["-betterC"]), + tuple(BuildOption.lowmem, ["-lowmem"]), tuple(BuildOption._docs, ["-Dddocs"]), tuple(BuildOption._ddox, ["-Xfdocs.json", "-Df__dummy.html"]), diff --git a/source/dub/compilers/ldc.d b/source/dub/compilers/ldc.d index c4ba3ec..080fa52 100644 --- a/source/dub/compilers/ldc.d +++ b/source/dub/compilers/ldc.d @@ -45,6 +45,7 @@ tuple(BuildOption.property, ["-property"]), //tuple(BuildOption.profileGC, ["-?"]), tuple(BuildOption.betterC, ["-betterC"]), + tuple(BuildOption.lowmem, ["-lowmem"]), tuple(BuildOption._docs, ["-Dd=docs"]), tuple(BuildOption._ddox, ["-Xf=docs.json", "-Dd=__dummy_docs"]), diff --git a/source/dub/dub.d b/source/dub/dub.d index 9319e08..3bfb042 100644 --- a/source/dub/dub.d +++ b/source/dub/dub.d @@ -132,6 +132,7 @@ NativePath m_overrideSearchPath; string m_defaultCompiler; string m_defaultArchitecture; + bool m_defaultLowMemory; } /** The default placement location of fetched packages. @@ -288,6 +289,7 @@ determineDefaultCompiler(); m_defaultArchitecture = m_config.defaultArchitecture; + m_defaultLowMemory = m_config.defaultLowMemory; } @property void dryRun(bool v) { m_dryRun = v; } @@ -332,6 +334,13 @@ */ @property string defaultArchitecture() const { return m_defaultArchitecture; } + /** Returns the default low memory option to use for building D code. + + If set, the "defaultLowMemory" field of the DUB user or system + configuration file will be used. Otherwise false will be returned. + */ + @property bool defaultLowMemory() const { return m_defaultLowMemory; } + /** Loads the package that resides within the configured `rootPath`. */ void loadPackage() @@ -662,6 +671,7 @@ string[] import_modules; if (settings.single) lbuildsettings.importPaths ~= NativePath(mainfil).parentPath.toNativeString; + bool firstTimePackage = true; foreach (file; lbuildsettings.sourceFiles) { if (file.endsWith(".d")) { auto fname = NativePath(file).head.name; @@ -674,7 +684,10 @@ continue; } if (fname == "package.d") { - logWarn("Excluding package.d file from test due to https://issues.dlang.org/show_bug.cgi?id=11847"); + if (firstTimePackage) { + firstTimePackage = false; + logWarn("Excluding package.d file from test due to https://issues.dlang.org/show_bug.cgi?id=11847"); + } continue; } import_modules ~= dub.internal.utils.determineModuleName(lbuildsettings, NativePath(file), m_project.rootPackage.path); @@ -765,6 +778,7 @@ settings.compiler = getCompiler(compiler_binary); settings.platform = settings.compiler.determinePlatform(settings.buildSettings, compiler_binary, m_defaultArchitecture); settings.buildType = "debug"; + if (m_defaultLowMemory) settings.buildSettings.options |= BuildOption.lowmem; settings.run = true; foreach (dependencyPackage; m_project.dependencies) @@ -1261,6 +1275,7 @@ settings.buildType = "debug"; settings.run = true; settings.runArgs = runArgs; + if (m_defaultLowMemory) settings.buildSettings.options |= BuildOption.lowmem; initSubPackage.recipe.buildSettings.workingDirectory = path.toNativeString(); template_dub.generateProject("build", settings); } @@ -1331,6 +1346,7 @@ settings.compiler = getCompiler(compiler_binary); // TODO: not using --compiler ??? settings.platform = settings.compiler.determinePlatform(settings.buildSettings, compiler_binary, m_defaultArchitecture); settings.buildType = "debug"; + if (m_defaultLowMemory) settings.buildSettings.options |= BuildOption.lowmem; settings.run = true; auto filterargs = m_project.rootPackage.recipe.ddoxFilterArgs.dup; @@ -1833,4 +1849,12 @@ if (m_parentConfig) return m_parentConfig.defaultArchitecture; return null; } + + @property bool defaultLowMemory() + const { + if(auto pv = "defaultLowMemory" in m_data) + return (*pv).get!bool; + if (m_parentConfig) return m_parentConfig.defaultLowMemory; + return false; + } } diff --git a/source/dub/generators/generator.d b/source/dub/generators/generator.d index 3eeb807..db21e51 100644 --- a/source/dub/generators/generator.d +++ b/source/dub/generators/generator.d @@ -96,6 +96,7 @@ BuildSettings buildSettings; auto config = configs[pack.name]; buildSettings.processVars(m_project, pack, pack.getBuildSettings(settings.platform, config), settings, true); + if (settings.buildSettings.options & BuildOption.lowmem) buildSettings.options |= BuildOption.lowmem; prepareGeneration(pack, m_project, settings, buildSettings); @@ -245,7 +246,7 @@ // add main source files to root executable { auto bs = &roottarget.buildSettings; - if (bs.targetType == TargetType.executable) bs.addSourceFiles(mainSourceFiles); + if (bs.targetType == TargetType.executable || genSettings.single) bs.addSourceFiles(mainSourceFiles); } if (genSettings.filterVersions) diff --git a/source/dub/project.d b/source/dub/project.d index d406421..1c5b4a2 100644 --- a/source/dub/project.d +++ b/source/dub/project.d @@ -384,7 +384,7 @@ resolveSubPackage(p, false); } - if (!p && !vspec.path.empty) { + if (!p && !vspec.path.empty && is_desired) { NativePath path = vspec.path; if (!path.absolute) path = pack.path ~ path; logDiagnostic("%sAdding local %s in %s", indent, dep.name, path); diff --git a/test/.gitignore b/test/.gitignore index 6b02e75..7170394 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -18,3 +18,4 @@ /test_registry /issue_2051_running_unittests_from_dub_single_file_packages_fails +/run-unittest diff --git a/test/0-init-fail-json.script.d b/test/0-init-fail-json.script.d new file mode 100644 index 0000000..d629385 --- /dev/null +++ b/test/0-init-fail-json.script.d @@ -0,0 +1,36 @@ +/+ dub.sdl: + name "0-init-fail-json" + dependency "common" path="./common" + +/ + +module _0_init_fail_json; + +import std.file : exists, remove; +import std.path : buildPath; +import std.process : environment, spawnProcess, wait; + +import common; + +int main() +{ + enum packname = "0-init-fail-pack"; + enum deps = "logger PACKAGE_DONT_EXIST"; // would be very unlucky if it does exist... + + auto dub = environment.get("DUB"); + if (!dub.length) + die(`Environment variable "DUB" must be defined to run the tests.`); + + //** if $$DUB init -n $packname $deps -f json 2>/dev/null; then + if (!spawnProcess([dub, "init", "-n", packname, deps, "-f", "json"]).wait) + die("Init with unknown non-existing dependency expected to fail"); + + //** if [ -e $packname/dub.json ]; then # package is there, it should have failed + const filepath = buildPath(packname, "dub.json"); + if (filepath.exists) + { + remove(packname); + die(filepath ~ " was not created"); + } + + return 0; +} diff --git a/test/0-init-fail-json.sh b/test/0-init-fail-json.sh deleted file mode 100755 index 069014e..0000000 --- a/test/0-init-fail-json.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -. $(dirname "${BASH_SOURCE[0]}")/common.sh -packname="0-init-fail-pack" -deps="logger PACKAGE_DONT_EXIST" # would be very unlucky if it does exist... - -if $$DUB init -n $packname $deps -f json 2>/dev/null; then - die $LINENO 'Init with unknown non-existing dependency expected to fail' -fi - - -function cleanup { - rm -rf $packname -} - -if [ -e $packname/dub.json ]; then # package is there, it should have failed - cleanup - die $LINENO "$packname/dub.json was not created" -fi diff --git a/test/common/.no_build b/test/common/.no_build new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/common/.no_build diff --git a/test/common/.no_run b/test/common/.no_run new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/common/.no_run diff --git a/test/common/.no_test b/test/common/.no_test new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/common/.no_test diff --git a/test/common/dub.sdl b/test/common/dub.sdl new file mode 100644 index 0000000..07cd175 --- /dev/null +++ b/test/common/dub.sdl @@ -0,0 +1,6 @@ +name "common" +description "Utility package for test suite" +authors "drug007" +copyright "The D language Foundation" +license "BSL-1.0" +targetType "sourceLibrary" diff --git a/test/common/source/common.d b/test/common/source/common.d new file mode 100644 index 0000000..796a059 --- /dev/null +++ b/test/common/source/common.d @@ -0,0 +1,40 @@ +module common; + +import std.conv : text; +import std.stdio : File, stdout, stderr; + +/// Name of the log file +enum logFile = "test.log"; + +/// has true if some test fails +bool any_errors = false; + +/// prints (non error) message to standard output and log file +void log(Args...)(Args args) + if (Args.length) +{ + const str = text("[INFO] ", args); + version(Windows) stdout.writeln(str); + else stdout.writeln("\033[0;33m", str, "\033[0m"); + stdout.flush; + File(logFile, "a").writeln(str); +} + +/// prints error message to standard error stream and log file +/// and set any_errors var to true value to indicate that some +/// test fails +void logError(Args...)(Args args) +{ + const str = text("[ERROR] ", args); + version(Windows) stderr.writeln(str); + else stderr.writeln("\033[0;31m", str, "\033[0m"); + stderr.flush; + File(logFile, "a").writeln(str); + any_errors = true; +} + +void die(Args...)(Args args) +{ + stderr.writeln(args); + throw new Exception("Test failed"); +} diff --git a/test/issue1505-single-file-package-dynamic-library.d b/test/issue1505-single-file-package-dynamic-library.d new file mode 100644 index 0000000..56337a6 --- /dev/null +++ b/test/issue1505-single-file-package-dynamic-library.d @@ -0,0 +1,13 @@ +/+ dub.sdl: + name "single-file-test-dynamic-library" + targetType "dynamicLibrary" ++/ + +module hellolib; + +version(Windows) +{ + import core.sys.windows.dll; + + mixin SimpleDllMain; +} diff --git a/test/issue1505-single-file-package-dynamic-library.sh b/test/issue1505-single-file-package-dynamic-library.sh new file mode 100755 index 0000000..a08bef6 --- /dev/null +++ b/test/issue1505-single-file-package-dynamic-library.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +. $(dirname "${BASH_SOURCE[0]}")/common.sh +cd ${CURR_DIR} +rm -f libsingle-file-test-dynamic-library.{so,dylib} +rm -f single-file-test-dynamic-library.dll + +${DUB} build --single issue1505-single-file-package-dynamic-library.d +if [ ! -f libsingle-file-test-dynamic-library.{so,dylib} ] && [ ! -f single-file-test-dynamic-library.dll ]; then + die $LINENO 'Normal invocation did not produce a dynamic library in the current directory' +fi +rm -f libsingle-file-test-dynamic-library.{so,dylib} +rm -f single-file-test-dynamic-library.dll diff --git a/test/issue1867-lowmem.sh b/test/issue1867-lowmem.sh new file mode 100755 index 0000000..6a39653 --- /dev/null +++ b/test/issue1867-lowmem.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +. $(dirname "${BASH_SOURCE[0]}")/common.sh +DIR=$(dirname "${BASH_SOURCE[0]}") + +if ! { ${DUB} build --root ${DIR}/issue1867-lowmem -v -f 2>&1 || true; } | grep -cF " -lowmem " > /dev/null; then + die $LINENO 'DUB build with lowmem did not find -lowmem option.' +fi + +if ! { ${DUB} test --root ${DIR}/issue1867-lowmem -v -f 2>&1 || true; } | grep -cF " -lowmem " > /dev/null; then + die $LINENO 'DUB test with lowmem did not find -lowmem option.' +fi + +if ! { ${DUB} run --root ${DIR}/issue1867-lowmem -v -f 2>&1 || true; } | grep -cF " -lowmem " > /dev/null; then + die $LINENO 'DUB test with lowmem did not find -lowmem option.' +fi + +if ! { ${DUB} describe --root ${DIR}/issue1867-lowmem --data=options --data-list --verror 2>&1 || true; } | grep -cF "lowmem" > /dev/null; then + die $LINENO 'DUB describe --data=options --data-list with lowmem did not find lowmem option.' +fi diff --git a/test/issue1867-lowmem/.gitignore b/test/issue1867-lowmem/.gitignore new file mode 100644 index 0000000..3b21cd5 --- /dev/null +++ b/test/issue1867-lowmem/.gitignore @@ -0,0 +1,15 @@ +.dub +docs.json +__dummy.html +docs/ +/issue1867-lowmem +issue1867-lowmem.so +issue1867-lowmem.dylib +issue1867-lowmem.dll +issue1867-lowmem.a +issue1867-lowmem.lib +issue1867-lowmem-test-* +*.exe +*.o +*.obj +*.lst diff --git a/test/issue1867-lowmem/.no_build b/test/issue1867-lowmem/.no_build new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/issue1867-lowmem/.no_build diff --git a/test/issue1867-lowmem/.no_run b/test/issue1867-lowmem/.no_run new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/issue1867-lowmem/.no_run diff --git a/test/issue1867-lowmem/.no_test b/test/issue1867-lowmem/.no_test new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/issue1867-lowmem/.no_test diff --git a/test/issue1867-lowmem/dub.sdl b/test/issue1867-lowmem/dub.sdl new file mode 100644 index 0000000..2cf20c8 --- /dev/null +++ b/test/issue1867-lowmem/dub.sdl @@ -0,0 +1 @@ +name "issue1867-lowmem" diff --git a/test/issue1867-lowmem/dub.settings.json b/test/issue1867-lowmem/dub.settings.json new file mode 100644 index 0000000..6944fb1 --- /dev/null +++ b/test/issue1867-lowmem/dub.settings.json @@ -0,0 +1,3 @@ +{ + "defaultLowMemory": true +} diff --git a/test/issue1867-lowmem/source/app.d b/test/issue1867-lowmem/source/app.d new file mode 100644 index 0000000..c3eec7f --- /dev/null +++ b/test/issue1867-lowmem/source/app.d @@ -0,0 +1,6 @@ +import std.stdio; + +void main() +{ + writeln("Edit source/app.d to start your project."); +} diff --git a/test/issue2046-ignored-optional-with-path/.no_build b/test/issue2046-ignored-optional-with-path/.no_build new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/issue2046-ignored-optional-with-path/.no_build diff --git a/test/issue2046-ignored-optional-with-path/.no_run b/test/issue2046-ignored-optional-with-path/.no_run new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/issue2046-ignored-optional-with-path/.no_run diff --git a/test/issue2046-ignored-optional-with-path/.no_test b/test/issue2046-ignored-optional-with-path/.no_test new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/issue2046-ignored-optional-with-path/.no_test diff --git a/test/issue2046-ignored-optional-with-path/dub.json b/test/issue2046-ignored-optional-with-path/dub.json new file mode 100644 index 0000000..ef1f533 --- /dev/null +++ b/test/issue2046-ignored-optional-with-path/dub.json @@ -0,0 +1,6 @@ +{ + "name": "issue2046", + "dependencies": { + "libbar": "*" + } +} diff --git a/test/issue2046-ignored-optional-with-path/dub.selections.json-nofoo b/test/issue2046-ignored-optional-with-path/dub.selections.json-nofoo new file mode 100644 index 0000000..36ce7a9 --- /dev/null +++ b/test/issue2046-ignored-optional-with-path/dub.selections.json-nofoo @@ -0,0 +1,6 @@ +{ + "fileVersion": 1, + "versions": { + "libbar": {"path":"libbar"} + } +} diff --git a/test/issue2046-ignored-optional-with-path/dub.selections.json-usefoo b/test/issue2046-ignored-optional-with-path/dub.selections.json-usefoo new file mode 100644 index 0000000..0a1cfd3 --- /dev/null +++ b/test/issue2046-ignored-optional-with-path/dub.selections.json-usefoo @@ -0,0 +1,7 @@ +{ + "fileVersion": 1, + "versions": { + "libfoo": {"path":"libfoo"}, + "libbar": {"path":"libbar"} + } +} diff --git a/test/issue2046-ignored-optional-with-path/libbar/dub.json b/test/issue2046-ignored-optional-with-path/libbar/dub.json new file mode 100644 index 0000000..79b37bc --- /dev/null +++ b/test/issue2046-ignored-optional-with-path/libbar/dub.json @@ -0,0 +1,6 @@ +{ + "name": "libbar", + "dependencies": { + "libfoo": {"path": "../libfoo", "version": "*", "optional": true} + } +} diff --git a/test/issue2046-ignored-optional-with-path/libbar/source/libbar/bar.d b/test/issue2046-ignored-optional-with-path/libbar/source/libbar/bar.d new file mode 100644 index 0000000..ab7b615 --- /dev/null +++ b/test/issue2046-ignored-optional-with-path/libbar/source/libbar/bar.d @@ -0,0 +1,11 @@ +module libbar.bar; + +void function() bar; +static this() +{ + version (Have_libfoo) + import libfoo.foo; + else + static void foo() { import std; writeln("no-foo"); } + bar = &foo; +} diff --git a/test/issue2046-ignored-optional-with-path/libfoo/dub.json b/test/issue2046-ignored-optional-with-path/libfoo/dub.json new file mode 100644 index 0000000..1dffb49 --- /dev/null +++ b/test/issue2046-ignored-optional-with-path/libfoo/dub.json @@ -0,0 +1,3 @@ +{ + "name": "libfoo" +} diff --git a/test/issue2046-ignored-optional-with-path/libfoo/source/libfoo/foo.d b/test/issue2046-ignored-optional-with-path/libfoo/source/libfoo/foo.d new file mode 100644 index 0000000..2ad2c1e --- /dev/null +++ b/test/issue2046-ignored-optional-with-path/libfoo/source/libfoo/foo.d @@ -0,0 +1,3 @@ +module libfoo.foo; +import std; +void foo() { writeln("use-foo"); } diff --git a/test/issue2046-ignored-optional-with-path/source/app.d b/test/issue2046-ignored-optional-with-path/source/app.d new file mode 100644 index 0000000..fcf2da6 --- /dev/null +++ b/test/issue2046-ignored-optional-with-path/source/app.d @@ -0,0 +1,6 @@ +import libbar.bar; + +void main() +{ + bar(); +} diff --git a/test/run-unittest.d b/test/run-unittest.d index 5575743..e2b2e26 100644 --- a/test/run-unittest.d +++ b/test/run-unittest.d @@ -2,44 +2,11 @@ /+dub.sdl: name: run_unittest targetName: run-unittest + dependency "common" path="./common" +/ module run_unittest; -/// Name of the log file -enum logFile = "test.log"; - -/// has true if some test fails -bool any_errors = false; - -/// prints (non error) message to standard output and log file -void log(Args...)(Args args) - if (Args.length) -{ - import std.conv : text; - import std.stdio : File, stdout; - - const str = text("[INFO] ", args); - version(Windows) stdout.writeln(str); - else stdout.writeln("\033[0;33m", str, "\033[0m"); - stdout.flush; - File(logFile, "a").writeln(str); -} - -/// prints error message to standard error stream and log file -/// and set any_errors var to true value to indicate that some -/// test fails -void logError(Args...)(Args args) -{ - import std.conv : text; - import std.stdio : File, stderr; - - const str = text("[ERROR] ", args); - version(Windows) stderr.writeln(str); - else stderr.writeln("\033[0;31m", str, "\033[0m"); - stderr.flush; - File(logFile, "a").writeln(str); - any_errors = true; -} +import common; int main(string[] args) { @@ -54,7 +21,6 @@ //** die $LINENO 'Variable $DUB must be defined to run the tests.' //** fi auto dub = environment.get("DUB", ""); - writeln("DUB: ", dub); if (dub == "") { logError(`Environment variable "DUB" must be defined to run the tests.`); @@ -81,13 +47,13 @@ //** CURR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) //** FRONTEND="${FRONTEND:-}" const dc_bin = baseName(dc); - const curr_dir = args[0].absolutePath.dirName.buildNormalizedPath; + const curr_dir = __FILE_FULL_PATH__.dirName(); const frontend = environment.get("FRONTEND", ""); //** if [ "$#" -gt 0 ]; then FILTER=$1; else FILTER=".*"; fi auto filter = (args.length > 1) ? args[1] : "*"; - version(linux) + version (Posix) { //** for script in $(ls $CURR_DIR/*.sh); do //** if [[ ! "$script" =~ $FILTER ]]; then continue; fi @@ -107,5 +73,16 @@ } } + foreach (DirEntry script; dirEntries(curr_dir, (args.length > 1) ? args[1] : "*.script.d", SpanMode.shallow)) + { + const min_frontend = script.name ~ ".min_frontend"; + if (frontend.length && exists(min_frontend) && frontend < min_frontend.readText) continue; + log("Running " ~ script ~ "..."); + if (spawnProcess([dub, script.name], ["DUB":dub, "DC":dc, "CURR_DIR":curr_dir]).wait) + logError("Script failure."); + else + log(script.name, " status: Ok"); + } + return any_errors; }