Skip to content

Commit bc10c3f

Browse files
committed
Make build script less noisy, integrate with makefile using 6 jobs (Takes next to no time for me)
1 parent 145b3f1 commit bc10c3f

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

book/build.d

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
module book.build;
22
import std;
3-
void compileToPath(string compileThis, string outputPath)
3+
void compileToPath(string compileThis, string outputPath, bool loud = false)
44
{
55
import core.stdc.stdlib;
66
if(outputPath.indexOf("cozum") == -1)
77
{
8-
writeln("wow");
9-
writeln(outputPath.replace(".html", ".cozum.html"));
8+
if(loud)
9+
writeln(outputPath.replace(".html", ".cozum.html"));
1010
//exit(0);
1111
}
1212

1313
const compileString = format!"dmd -revert=markdown -D macros.ddoc html.ddoc dlang.org.ddoc doc.ddoc aliBook.ddoc %s -Df%s "(compileThis, outputPath);
14-
writefln!"%s:%s |> %s"(compileThis, outputPath, compileString);
14+
if(loud)
15+
writefln!"%s:%s |> %s"(compileThis, outputPath, compileString);
1516
const res = executeShell(compileString);
16-
writeln("\t\t", res.status);
1717

1818
if(res.status != 0) {
1919
write(res.output);
2020

2121
exit(0);
2222
}
2323
}
24-
int main()
24+
int main(string[] args)
2525
{
26+
const jobs = args.length == 2 ? args[1].to!ubyte : 1;
2627
const outDir = "../web/book";
2728
writeln("Building the book at ", outDir);
2829
//scope(failure) return 1;
@@ -31,13 +32,11 @@ int main()
3132
if(outDir.exists) {
3233
executeShell("rm -rf " ~ outDir);
3334
}
34-
writeln("Building book files");
3535
auto rng = dirEntries("d.en", "*.d", SpanMode.shallow)
3636
.map!(dFile => tuple(dFile.name, buildPath(outDir, baseName(dFile).setExtension("html"))))
37-
//.parallel(1)
37+
.parallel(jobs)
3838
.each!(elem => compileToPath(elem.tupleof));
3939
dirEntries("d.en", "*.png", SpanMode.shallow)
4040
.each!(p => copy(p, buildPath(outDir, baseName(p).setExtension("png"))));
41-
writeln("Finished");
4241
return 0;
4342
}

posix.mak

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,10 @@ docs-prerelease: dmd-prerelease druntime-prerelease phobos-prerelease apidocs-pr
383383

384384
docs : docs-latest docs-prerelease
385385

386-
html : $(ALL_FILES)
386+
html : $(ALL_FILES) makebook
387387

388+
makebook:
389+
(cd book && rdmd build.d 6)
388390
html-verbatim: $(addprefix $W/, $(addsuffix .verbatim,$(PAGES_ROOT)))
389391

390392
verbatim : html-verbatim phobos-prerelease-verbatim

0 commit comments

Comments
 (0)