diff --git a/source/dub/compilers/compiler.d b/source/dub/compilers/compiler.d index de8e1d0..bd86769 100644 --- a/source/dub/compilers/compiler.d +++ b/source/dub/compilers/compiler.d @@ -45,7 +45,7 @@ s_compilers ~= c; } -void warnOnSpecialCompilerFlags(string[] compiler_flags, string package_name) +void warnOnSpecialCompilerFlags(string[] compiler_flags, string package_name, string config_name) { import vibecompat.core.log; struct SpecialFlag { @@ -75,12 +75,11 @@ if (got_preamble) return; got_preamble = true; logWarn(""); - logWarn("Warning"); - logWarn("======="); + if (config_name.empty) logWarn("## Warning for package %s ##", package_name); + else logWarn("## Warning for package %s, configuration %s ##", package_name, config_name); logWarn(""); - logWarn("The following compiler flags have been specified in %s's", package_name); - logWarn("package description file. They are handled by DUB and direct use in packages is"); - logWarn("discouraged."); + logWarn("The following compiler flags have been specified in the package description"); + logWarn("file. They are handled by DUB and direct use in packages is discouraged."); logWarn("Alternatively, you can set the DFLAGS environment variable to pass custom flags"); logWarn("to the compiler, or use one of the suggestions below:"); logWarn(""); diff --git a/source/dub/dub.d b/source/dub/dub.d index 20eb446..4cdd2ea 100644 --- a/source/dub/dub.d +++ b/source/dub/dub.d @@ -144,7 +144,8 @@ if(a.type == Action.Type.install) install(a.packageId, a.vers, a.location); - m_project.reinit(); + if (!actions.empty) m_project.reinit(); + Action[] newActions = m_project.determineActions(m_packageSuppliers, 0); if(newActions.length > 0) { logInfo("There are still some actions to perform:"); diff --git a/source/dub/package_.d b/source/dub/package_.d index 8a8f80e..7ad5296 100644 --- a/source/dub/package_.d +++ b/source/dub/package_.d @@ -145,11 +145,6 @@ m_info.configurations ~= ConfigurationInfo("library", lib_settings); } } - - // warn about use of special flags - m_info.buildSettings.warnOnSpecialCompilerFlags(m_info.name); - foreach (ref config; m_info.configurations) - config.buildSettings.warnOnSpecialCompilerFlags(m_info.name); } @property string name() const { return m_info.name; } @@ -168,6 +163,14 @@ return ret.data; } + void warnOnSpecialCompilerFlags() + { + // warn about use of special flags + m_info.buildSettings.warnOnSpecialCompilerFlags(m_info.name, null); + foreach (ref config; m_info.configurations) + config.buildSettings.warnOnSpecialCompilerFlags(m_info.name, config.name); + } + /// Returns all BuildSettings for the given platform and config. BuildSettings getBuildSettings(in BuildPlatform platform, string config) const { @@ -519,10 +522,12 @@ } } - void warnOnSpecialCompilerFlags(string package_name) + void warnOnSpecialCompilerFlags(string package_name, string config_name) { + string[] all_dflags; foreach (flags; this.dflags) - .warnOnSpecialCompilerFlags(flags, package_name); + all_dflags ~= flags; + .warnOnSpecialCompilerFlags(all_dflags, package_name, config_name); } } diff --git a/source/dub/project.d b/source/dub/project.d index 85cb52f..0113d19 100644 --- a/source/dub/project.d +++ b/source/dub/project.d @@ -137,7 +137,8 @@ } /// Rereads the applications state. - void reinit() { + void reinit() + { scope(failure){ logDebug("Failed to initialize project. Assuming defaults."); m_main = new Package(serializeToJson(["name": "unknown"]), InstallLocation.local, m_root); @@ -159,6 +160,7 @@ } m_main = new Package(InstallLocation.local, m_root); + m_main.warnOnSpecialCompilerFlags(); // TODO: compute the set of mutual dependencies first // (i.e. ">=0.0.1 <=0.0.5" and "<= 0.0.4" get ">=0.0.1 <=0.0.4") @@ -180,6 +182,7 @@ logDebug("Found dependency %s %s: %s", name, vspec.toString(), p !is null); if( p ){ m_dependencies ~= p; + p.warnOnSpecialCompilerFlags(); collectDependenciesRec(p); } }