Fix typos.
1 parent fbdd60e commit 2f3c6ab3080dfc2bf1de1286ff93127d7aeddf31
@Sönke Ludwig Sönke Ludwig authored on 28 Nov 2016
Showing 2 changed files
View
4
source/dub/commandline.d
args.getopt("c|config", &m_buildConfig, [
"Builds the specified configuration. Configurations can be defined in dub.json"
]);
args.getopt("override-config", &m_overrideConfigs, [
"Uses the specified configuration for a certain dependency (format: --override-config <dependency>/<config>).",
"Can be specified multiple fimes."
"Uses the specified configuration for a certain dependency. Can be specified multiple times.",
"Format: --override-config=<dependency>/<config>"
]);
args.getopt("compiler", &m_compilerName, [
"Specifies the compiler binary to use (can be a path).",
"Arbitrary pre- and suffixes to the identifiers below are recognized (e.g. ldc2 or dmd-2.063) and matched to the proper compiler type:",
View
12
source/dub/project.d
Package[] m_dependencies;
Package[][Package] m_dependees;
SelectedVersions m_selections;
bool m_hasAllDependencies;
string[string] m_overridenConfigs;
string[string] m_overriddenConfigs;
}
 
/** Loads a project.
 
 
Params:
package_ = The package for which to force selecting a certain
dependency
config = Name of the configuration to force.
config = Name of the configuration to force
*/
void overrideConfiguration(string package_, string config)
{
auto p = getDependency(package_, true);
enforce(p !is null,
format("Package '%s', marked for configuration override, is not present in dependency graph.", package_));
enforce(p.configurations.canFind(config),
format("Package '%s' does not have a configuration named '%s'.", package_, config));
m_overridenConfigs[package_] = config;
m_overriddenConfigs[package_] = config;
}
 
/** Performs basic validation of various aspects of the package.
 
size_t createConfig(string pack, string config) {
foreach (i, v; configs)
if (v.pack == pack && v.config == config)
return i;
assert(pack !in m_overridenConfigs || config == m_overridenConfigs[pack]);
assert(pack !in m_overriddenConfigs || config == m_overriddenConfigs[pack]);
logDebug("Add config %s %s", pack, config);
configs ~= Vertex(pack, config);
return configs.length-1;
}
auto dp = getDependency(d.name, true);
if (!dp) continue;
 
string[] cfgs;
if (auto pc = dp.name in m_overridenConfigs) cfgs = [*pc];
if (auto pc = dp.name in m_overriddenConfigs) cfgs = [*pc];
else {
auto subconf = p.getSubConfiguration(c, dp, platform);
if (!subconf.empty) cfgs = [subconf];
else cfgs = dp.getPlatformConfigurations(platform);
determineAllConfigs(dp);
}
 
// for each configuration, determine the configurations usable for the dependencies
if (auto pc = p.name in m_overridenConfigs)
if (auto pc = p.name in m_overriddenConfigs)
determineDependencyConfigs(p, *pc);
else
foreach (c; p.getPlatformConfigurations(platform, p is m_rootPackage && allow_non_library))
determineDependencyConfigs(p, c);