Skip to content

Commit

Permalink
Allow sub configurations to be specified as part of the dependency spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-ludwig committed Jul 10, 2017
1 parent 39ae3ab commit 9cb4f3d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions source/dub/recipe/json.d
Expand Up @@ -158,6 +158,8 @@ private Json toJson(in ref ConfigurationInfo config)

private void parseJson(ref BuildSettingsTemplate bs, Json json, string package_name)
{
string[string] additional_sub_configs;

foreach(string name, value; json)
{
auto idx = indexOf(name, "-");
Expand All @@ -174,6 +176,8 @@ private void parseJson(ref BuildSettingsTemplate bs, Json json, string package_n
}
enforce(pkg !in bs.dependencies, "The dependency '"~pkg~"' is specified more than once." );
bs.dependencies[pkg] = deserializeJson!Dependency(verspec);
if (verspec.type == Json.Type.object && "config" in verspec)
additional_sub_configs[pkg] = verspec["config"].get!string;
}
break;
case "systemDependencies":
Expand Down Expand Up @@ -234,6 +238,9 @@ private void parseJson(ref BuildSettingsTemplate bs, Json json, string package_n
break;
}
}

foreach (p, c; additional_sub_configs)
bs.subConfigurations[p] = c;
}

private Json toJson(in ref BuildSettingsTemplate bs)
Expand Down
3 changes: 3 additions & 0 deletions source/dub/recipe/sdl.d
Expand Up @@ -189,6 +189,9 @@ private void parseDependency(Tag t, ref BuildSettingsTemplate bs, string package
if ("default" in attrs)
dep.default_ = attrs["default"][0].value.get!bool;

if ("config" in attrs)
bs.subConfigurations[pkg] = attrs["config"][0].value.get!string;

bs.dependencies[pkg] = dep;
}

Expand Down

0 comments on commit 9cb4f3d

Please sign in to comment.