Skip to content

Commit

Permalink
Added: --breadth flag #38
Browse files Browse the repository at this point in the history
  • Loading branch information
MrcSnm committed Feb 27, 2025
1 parent 5c9aaa8 commit 434e48d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,11 @@ update
writeln(RedubVersion);
return ProjectDetails(null, Compiler.init, ParallelType.auto_, CompilationDetails.init, false, true);
}
if(bArgs.breadth)
{
import redub.command_generators.commons;
setSpanModeAsBreadth(bArgs.breadth);
}

if(bArgs.arch && !bArgs.compiler) bArgs.compiler = "ldc2";
DubCommonArguments cArgs = bArgs.cArgs;
Expand Down
2 changes: 1 addition & 1 deletion source/redub/buildapi.d
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import redub.package_searching.api;


///vX.X.X
enum RedubVersionOnly = "v1.21.0";
enum RedubVersionOnly = "v1.21.1";
///Redub vX.X.X
enum RedubVersionShort = "Redub "~RedubVersionOnly;
///Redub vX.X.X - Description
Expand Down
4 changes: 4 additions & 0 deletions source/redub/cli/dub.d
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ struct DubArguments
@("Specifies the target name")
string targetName;


@("Uses breadth first search for source files, replicating how dub adds files to project. Might be a little slower")
bool breadth;

@(
"Specifies a version string which contains the compiler name and its version "~
"This can make the dependency resolution a lot faster since executing compiler --version won't be necessary "~
Expand Down
9 changes: 8 additions & 1 deletion source/redub/command_generators/commons.d
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,13 @@ bool isFileHidden(DirEntry e)
}
}


private __gshared bool useBreadth;
void setSpanModeAsBreadth(bool breadth)
{
useBreadth = breadth;
}

void putSourceFiles(
ref string[] output,
const string workingDir,
Expand All @@ -349,7 +356,7 @@ void putSourceFiles(

foreach(path; paths)
{
DirEntryLoop: foreach(DirEntry e; dirEntries(unescapePath(path), SpanMode.depth))
DirEntryLoop: foreach(DirEntry e; dirEntries(unescapePath(path), useBreadth ? SpanMode.breadth : SpanMode.depth))
{
foreach(exclusion; excludeFiles)
if(e.name.globMatch(exclusion))
Expand Down

0 comments on commit 434e48d

Please sign in to comment.