Skip to content

Commit

Permalink
dscan.d: Build unittest docs alongside default docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zorael committed Feb 25, 2025
1 parent a5fe39e commit 4e2f1f8
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions dscan.d
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public auto main(string[] args)

retval |= runDscanner(engines, expressions, target);
retval |= buildDocs();
retval |= buildDocs("unittest");

writeln();
writeln(i"[+] done, return $(retval)");
Expand Down Expand Up @@ -257,18 +258,21 @@ auto runDscanner(
/++
Simply invokes `dub build -b docs`.`
Params:
buildConfiguration = Optional dub build configuration to build docs with.
Returns:
The shell return value of the command run.
+/
auto buildDocs()
auto buildDocs(const string buildConfiguration = string.init)
{
import std.datetime.stopwatch : StopWatch;
import std.process : execute;
import std.string : strip;

StopWatch sw;

static immutable command =
auto command =
[
"dub",
"build",
Expand All @@ -278,9 +282,17 @@ auto buildDocs()
//"--vquiet",
];

if (buildConfiguration.length)
{
command ~= [ "-c", buildConfiguration ];
}

immutable buildConfigString = buildConfiguration.length ?
" (" ~ buildConfiguration ~ '}' :
string.init;

writeln();
writeln("[+] building docs...");
writeln(i"[+] building docs$(buildConfigString)...");

sw.start();
const result = execute(command);
Expand Down

0 comments on commit 4e2f1f8

Please sign in to comment.