Skip to content

Commit

Permalink
reorder statements for code clarity
Browse files Browse the repository at this point in the history
make it clear what part of the code is used for recursive build
  • Loading branch information
rtbo authored and WebFreak001 committed Aug 16, 2023
1 parent 1ef555e commit 4ea6681
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions source/dub/generators/build.d
Expand Up @@ -97,6 +97,17 @@ class BuildGenerator : ProjectGenerator {
settings.buildType.color(Color.magenta), settings.platform.compilerBinary,
settings.platform.architecture);

if (settings.rdmd || (rootTT == TargetType.staticLibrary && !settings.buildDeep)) {
// Only build the main target.
// RDMD always builds everything at once and static libraries don't need their
// dependencies to be built, unless --deep flag is specified
NativePath tpath;
buildTarget(settings, root_ti.buildSettings.dup, m_project.rootPackage, root_ti.config, root_ti.packages, null, tpath);
return;
}

// Recursive build starts here

bool any_cached = false;

NativePath[string] target_paths;
Expand Down Expand Up @@ -166,15 +177,6 @@ class BuildGenerator : ProjectGenerator {
target_paths[target] = tpath;
}

// build all targets
if (settings.rdmd || (rootTT == TargetType.staticLibrary && !settings.buildDeep)) {
// RDMD always builds everything at once and static libraries don't need their
// dependencies to be built, unless --deep flag is specified
NativePath tpath;
buildTarget(settings, root_ti.buildSettings.dup, m_project.rootPackage, root_ti.config, root_ti.packages, null, tpath);
return;
}

buildTargetRec(m_project.rootPackage.name);

if (dynamicLibDepsFilesToCopy.length) {
Expand Down

0 comments on commit 4ea6681

Please sign in to comment.