From 4ea6681d6a2ea79f6b4b244a195702768cb270ab Mon Sep 17 00:00:00 2001 From: Remi Thebault Date: Sat, 12 Aug 2023 14:52:35 +0200 Subject: [PATCH] reorder statements for code clarity make it clear what part of the code is used for recursive build --- source/dub/generators/build.d | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/source/dub/generators/build.d b/source/dub/generators/build.d index ae2ac9a8c..d9fe7f20c 100644 --- a/source/dub/generators/build.d +++ b/source/dub/generators/build.d @@ -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; @@ -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) {