Is run.d going to be expand for runtime and the phobos library?
Avrina
avrina12309412342 at gmail.com
Sun Jun 14 00:31:53 UTC 2020
On Saturday, 13 June 2020 at 18:56:55 UTC, Andrei Alexandrescu
wrote:
> * Hundreds of lines of rules follow. It is natural to ask
> oneself to what extent they improve on makefile (or other build
> tools') syntax. I mean is this something easy on the eyes? Did
> build.d attain its objective?
>
> 582 /// BuildRule to generate man pages
> 583 alias man = makeRule!((builder, rule) {
> 584 alias genMan = methodInit!(BuildRule,
> (genManBuilder, genManRule) => genManBuilder
> 585 .target(env["G"].buildPath("gen_man"))
> 586 .sources([
> 587 dmdRepo.buildPath("docs", "gen_man.d"),
> 588 env["D"].buildPath("cli.d")])
> 589 .command([
> 590 env["HOST_DMD_RUN"],
> 591 "-I" ~ srcDir,
> 592 "-of" ~ genManRule.target]
> 593 ~ flags["DFLAGS"]
> 594 ~ genManRule.sources)
> 595 .msg(genManRule.command.join(" "))
> 596 );
> 597
> 598 const genManDir =
> env["GENERATED"].buildPath("docs", "man");
> 599 alias dmdMan = methodInit!(BuildRule,
> (dmdManBuilder, dmdManRule) => dmdManBuilder
> 600 .target(genManDir.buildPath("man1", "dmd.1"))
> 601 .deps([genMan,
> directoryRule(dmdManRule.target.dirName)])
> 602 .msg("(GEN_MAN) " ~ dmdManRule.target)
> 603 .commandFunction(() {
> 604 writeText(dmdManRule.target,
> genMan.target.execute.output);
> 605 })
> 606 );
> 607 builder
> 608 .name("man")
> 609 .description("Generate and prepare man files")
> 610 .deps([dmdMan].chain(
> 611 "man1/dumpobj.1 man1/obj2asm.1
> man5/dmd.conf.5".split
> 612 .map!(e => methodInit!(BuildRule,
> (manFileBuilder, manFileRule) => manFileBuilder
> 613 .target(genManDir.buildPath(e))
> 614 .sources([dmdRepo.buildPath("docs", "man",
> e)])
> 615
> .deps([directoryRule(manFileRule.target.dirName)])
> 616 .commandFunction(() =>
> copyAndTouch(manFileRule.sources[0], manFileRule.target))
> 617 .msg("copy '%s' to
> '%s'".format(manFileRule.sources[0], manFileRule.target))
> 618 ))
> 619 ).array);
> 620 });
>
I agree, "chaining" is touted as one of the benefits of D, but
whenever I see people using them they tend to be these types of
monstrosities with many inefficiencies. The developers tend to
not even know what's going on as most of the logic is hidden.
More information about the Digitalmars-d
mailing list