Skip to content

Commit

Permalink
Merge pull request #293 from atilaneves/faster-dub-configs
Browse files Browse the repository at this point in the history
Eagerly allocate allConfigurationsAsStrings
  • Loading branch information
atilaneves authored Apr 11, 2024
2 parents fe08d8d + 65df2b4 commit 5260790
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions payload/reggae/dub/interop/dublib.d
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,19 @@ package struct Dub {
.configurations
.filter!(c => c.matchesPlatform(_generatorSettings.platform))
.map!(c => c.name)
.array
;

if (!allConfigs) { // i.e. one single config specified by the user
// translate `unittest` to the actual test configuration
const requestedConfig = haveSpecialTestConfig ? testConfig : singleConfig;


const canFindConfig = allConfigurationsAsStrings.save.canFind(requestedConfig);
const canFindConfig = allConfigurationsAsStrings.canFind(requestedConfig);
if (!canFindConfig && requestedConfig != "default")
throw new Exception(
text("Unknown dub configuration `", requestedConfig, "` - known configurations:\n ",
allConfigurationsAsStrings.save)
allConfigurationsAsStrings)
);
// if the user requests "default", then give them the
// first available configuration, whether or not it's
Expand All @@ -210,7 +211,6 @@ package struct Dub {
}

auto configurations = allConfigurationsAsStrings
.save
// exclude unittest config if there's a derived special one
.filter!(n => !haveSpecialTestConfig || n != "unittest")
.array;
Expand Down

0 comments on commit 5260790

Please sign in to comment.