diff --git a/source/dub/compilers/compiler.d b/source/dub/compilers/compiler.d index 85aeb66..9e15d09 100644 --- a/source/dub/compilers/compiler.d +++ b/source/dub/compilers/compiler.d @@ -31,14 +31,14 @@ Compiler getCompiler(string name) { - foreach( c; s_compilers ) - if( c.name == name ) + foreach (c; s_compilers) + if (c.name == name) return c; // try to match names like gdmd or gdc-2.61 - if( name.canFind("dmd") ) return getCompiler("dmd"); - if( name.canFind("gdc") ) return getCompiler("gdc"); - if( name.canFind("ldc") ) return getCompiler("ldc"); + if (name.canFind("dmd")) return getCompiler("dmd"); + if (name.canFind("gdc")) return getCompiler("gdc"); + if (name.canFind("ldc")) return getCompiler("ldc"); throw new Exception("Unknown compiler: "~name); } @@ -129,7 +129,7 @@ if (f.startsWith("-Wl,")) settings.addLFlags(f[4 .. $].split(",")); else settings.addLFlags(f); } - } catch( Exception e ){ + } catch (Exception e) { logDiagnostic("pkg-config failed: %s", e.msg); logDiagnostic("Falling back to direct -lxyz flags."); version(Windows) settings.addSourceFiles(settings.libs.map!(l => l~".lib")().array()); @@ -266,23 +266,23 @@ /// true if the given specification matches this BuildPlatform, false otherwise. (The empty string matches) /// bool matchesSpecification(const(char)[] specification) const { - if(specification.empty) + if (specification.empty) return true; auto splitted=specification.splitter('-'); assert(!splitted.empty, "No valid platform specification! The leading hyphen is required!"); splitted.popFront(); // Drop leading empty match. enforce(!splitted.empty, "Platform specification if present, must not be empty!"); - if(platform.canFind(splitted.front)) { + if (platform.canFind(splitted.front)) { splitted.popFront(); if(splitted.empty) return true; } - if(architecture.canFind(splitted.front)) { + if (architecture.canFind(splitted.front)) { splitted.popFront(); if(splitted.empty) return true; } - if(compiler==splitted.front) { + if (compiler == splitted.front) { splitted.popFront(); enforce(splitted.empty, "No valid specification! The compiler has to be the last element!"); return true; @@ -344,7 +344,7 @@ string getTargetFileName(in BuildSettings settings, in BuildPlatform platform) { assert(settings.targetName.length > 0, "No target name set."); - final switch(settings.targetType){ + final switch (settings.targetType) { case TargetType.autodetect: assert(false, "Configurations must have a concrete target type."); case TargetType.none: return null; case TargetType.sourceLibrary: return null; diff --git a/source/dub/compilers/dmd.d b/source/dub/compilers/dmd.d index 108ffde..c098dc7 100644 --- a/source/dub/compilers/dmd.d +++ b/source/dub/compilers/dmd.d @@ -30,7 +30,7 @@ build_platform.architecture = .determineArchitecture(); build_platform.compiler = this.name; - switch(arch_override){ + switch (arch_override) { default: throw new Exception("Unsupported architecture: "~arch_override); case "": break; case "x86": @@ -47,30 +47,30 @@ void prepareBuildSettings(ref BuildSettings settings, BuildSetting fields = BuildSetting.all) { - if( !(fields & BuildSetting.libs) ) + if (!(fields & BuildSetting.libs)) resolveLibs(settings); - if( !(fields & BuildSetting.versions) ){ + if (!(fields & BuildSetting.versions)) { settings.addDFlags(settings.versions.map!(s => "-version="~s)().array()); settings.versions = null; } - if( !(fields & BuildSetting.importPaths) ){ + if (!(fields & BuildSetting.importPaths)) { settings.addDFlags(settings.importPaths.map!(s => "-I"~s)().array()); settings.importPaths = null; } - if( !(fields & BuildSetting.stringImportPaths) ){ + if (!(fields & BuildSetting.stringImportPaths)) { settings.addDFlags(settings.stringImportPaths.map!(s => "-J"~s)().array()); settings.stringImportPaths = null; } - if( !(fields & BuildSetting.sourceFiles) ){ + if (!(fields & BuildSetting.sourceFiles)) { settings.addDFlags(settings.sourceFiles); settings.sourceFiles = null; } - if( !(fields & BuildSetting.lflags) ){ + if (!(fields & BuildSetting.lflags)) { settings.addDFlags(settings.lflags.map!(f => "-L"~f)().array()); settings.lflags = null; } @@ -91,7 +91,7 @@ void setTarget(ref BuildSettings settings, in BuildPlatform platform) { - final switch(settings.targetType){ + final switch (settings.targetType) { case TargetType.autodetect: assert(false, "Invalid target type: autodetect"); case TargetType.none: assert(false, "Invalid target type: none"); case TargetType.sourceLibrary: assert(false, "Invalid target type: sourceLibrary"); diff --git a/source/dub/compilers/gdc.d b/source/dub/compilers/gdc.d index 3ff3468..870a18d 100644 --- a/source/dub/compilers/gdc.d +++ b/source/dub/compilers/gdc.d @@ -38,8 +38,8 @@ { // convert common DMD flags to the corresponding GDC flags string[] newdflags; - foreach(f; settings.dflags){ - switch(f){ + foreach (f; settings.dflags) { + switch (f) { default: newdflags ~= f; break; case "-cov": newdflags ~= ["-fprofile-arcs", "-ftest-coverage"]; break; case "-D": newdflags ~= "-fdoc"; break; @@ -91,27 +91,27 @@ if (!(fields & BuildSetting.libs)) resolveLibs(settings); - if( !(fields & BuildSetting.versions) ){ + if (!(fields & BuildSetting.versions)) { settings.addDFlags(settings.versions.map!(s => "-fversion="~s)().array()); settings.versions = null; } - if( !(fields & BuildSetting.importPaths) ){ + if (!(fields & BuildSetting.importPaths)) { settings.addDFlags(settings.importPaths.map!(s => "-I"~s)().array()); settings.importPaths = null; } - if( !(fields & BuildSetting.stringImportPaths) ){ + if (!(fields & BuildSetting.stringImportPaths)) { settings.addDFlags(settings.stringImportPaths.map!(s => "-J"~s)().array()); settings.stringImportPaths = null; } - if( !(fields & BuildSetting.sourceFiles) ){ + if (!(fields & BuildSetting.sourceFiles)) { settings.addDFlags(settings.sourceFiles); settings.sourceFiles = null; } - if( !(fields & BuildSetting.lflags) ){ + if (!(fields & BuildSetting.lflags)) { foreach( f; settings.lflags ) settings.addDFlags(["-Xlinker", f]); settings.lflags = null; @@ -133,7 +133,7 @@ void setTarget(ref BuildSettings settings, in BuildPlatform platform) { - final switch(settings.targetType){ + final switch (settings.targetType) { case TargetType.autodetect: assert(false, "Invalid target type: autodetect"); case TargetType.none: assert(false, "Invalid target type: none"); case TargetType.sourceLibrary: assert(false, "Invalid target type: sourceLibrary"); diff --git a/source/dub/compilers/ldc.d b/source/dub/compilers/ldc.d index 07fa103..3477fd4 100644 --- a/source/dub/compilers/ldc.d +++ b/source/dub/compilers/ldc.d @@ -38,8 +38,8 @@ { // convert common DMD flags to the corresponding GDC flags string[] newdflags; - foreach(f; settings.dflags){ - switch(f){ + foreach (f; settings.dflags) { + switch (f) { default: if (f.startsWith("-debug=")) newdflags ~= "-d-debug="~f[7 .. $]; else if (f.startsWith("-version=")) newdflags ~= "-d-version="~f[9 .. $]; @@ -58,27 +58,27 @@ if (!(fields & BuildSetting.libs)) resolveLibs(settings); - if( !(fields & BuildSetting.versions) ){ + if (!(fields & BuildSetting.versions)) { settings.addDFlags(settings.versions.map!(s => "-d-version="~s)().array()); settings.versions = null; } - if( !(fields & BuildSetting.importPaths) ){ + if (!(fields & BuildSetting.importPaths)) { settings.addDFlags(settings.importPaths.map!(s => "-I"~s)().array()); settings.importPaths = null; } - if( !(fields & BuildSetting.stringImportPaths) ){ + if (!(fields & BuildSetting.stringImportPaths)) { settings.addDFlags(settings.stringImportPaths.map!(s => "-J"~s)().array()); settings.stringImportPaths = null; } - if( !(fields & BuildSetting.sourceFiles) ){ + if (!(fields & BuildSetting.sourceFiles)) { settings.addDFlags(settings.sourceFiles); settings.sourceFiles = null; } - if( !(fields & BuildSetting.lflags) ){ + if (!(fields & BuildSetting.lflags)) { settings.addDFlags(settings.lflags.map!(s => "-L="~s)().array()); settings.lflags = null; } @@ -99,7 +99,7 @@ void setTarget(ref BuildSettings settings, in BuildPlatform platform) { - final switch(settings.targetType){ + final switch (settings.targetType) { case TargetType.autodetect: assert(false, "Invalid target type: autodetect"); case TargetType.none: assert(false, "Invalid target type: none"); case TargetType.sourceLibrary: assert(false, "Invalid target type: sourceLibrary");