Skip to content

Commit

Permalink
Move haveTestConfig to DubConfigurations
Browse files Browse the repository at this point in the history
  • Loading branch information
atilaneves committed Feb 28, 2024
1 parent acfa4da commit ee90192
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions payload/reggae/dub/interop/dublib.d
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ private struct DubConfigurations {
string[] configurations;
string default_;
string test; // special `dub test` config

bool haveTestConfig() @safe @nogc pure nothrow scope const {
return test != "";
}
}

package struct Dub {
Expand Down Expand Up @@ -83,12 +87,11 @@ package struct Dub {
DubInfo[string] ret;

const configs = dubConfigurations(output);
const haveTestConfig = configs.test != "";
bool atLeastOneConfigOk;
Exception dubInfoFailure;

foreach(config; configs.configurations) {
const isTestConfig = haveTestConfig && config == configs.test;
const isTestConfig = configs.haveTestConfig && config == configs.test;
try {
ret[config] = configToDubInfo(output, config, isTestConfig);
atLeastOneConfigOk = true;
Expand All @@ -109,7 +112,7 @@ package struct Dub {
// (additionally) expose the special `dub test` config as
// `unittest` config in the DSL (`configToDubInfo`) (for
// `dubTest!()`, `dubBuild!(Configuration("unittest"))` etc.)
if(haveTestConfig && configs.test != "unittest" && configs.test in ret)
if(configs.haveTestConfig && configs.test != "unittest" && configs.test in ret)
ret["unittest"] = ret[configs.test];

return ret;
Expand Down

0 comments on commit ee90192

Please sign in to comment.