Idea: std.build instead of dub and make-like tools

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Sat Mar 19 10:57:24 PDT 2016


On 03/19/2016 11:36 AM, Piotrek wrote:
> On Friday, 18 March 2016 at 15:31:26 UTC, Dicebot wrote:
>>> Hmm, the build module could be compiled once. It sources are supposed
>>> to stay unchanged, right?
>>
>> Even "once" will be too much for majority of D users (those who are
>> not also Gentoo users at least :D). Remember - we are not speaking
>> about build as simple as `rdmd std/build.d` at this point, it will
>> have numerous additional dependencies, including linker dependencies.
>> And has to be perfectly cross-platform.
> 
> I think that std.build could be up to 10KLOC so the compilation time
> would be not relevant.

dub existing sources are 24KLOC and it doesn't even have a real build
system. Compilation time is not a problem though. What is more
important, it needs external dependencies like curl which make
impossible to build on target platform transpatently via `rdmd
std/build.d`. You'll need a build system to build your build system.

>> When build tool and package management system are packed into one
>> tool, you pretty much need for both to be perfect to match everyones
>> desires. And that is simply impossible.
> 
> Thanks for explanation. Then let me quote Teoh's great description of a
> practical build tool:
> 
> "I think a good balance can be drawn between providing enough primitives
> that cover almost all conceivable use cases in a build tool, and at the
> same time provide an "escape hatch" into a full-fledged programming
> language for those rare but inevitable cases where you need to go
> outside the box and do what the designers didn't anticipate."
> 
> IMO this applies to all of compiling, configuring and fetching sources
> or binaries and their dependencies.
> 
> I'm aware it's not possible to cover all use cases. But 90-95% is
> achievable. The rest is relatively easily to be covered by custom d code.

Even 90% is not enough because it leads to forking functionality for
those 10%, greatly diminishing standartization. And build systems are
highly opinionated. Some people praise imperative systems like SCons - I
find it very hard to reason about compared to declarative ones (even
compare to Makefiles). Some like magic deduction of dependencies, some
stand hard by making stuff explicit. And list goes on.

Most importantly, there is no need to make it one-thing-fits-them-all -
building should be private affair of any given project and its
developers. All you need is to define standard project description
format that already built projects can be exposed with to other projects
- and that is something dub.sdl / dub.json are already pretty good at.

> I started that
> 
> Piotrek

Good luck with that anyway :)


More information about the Digitalmars-d mailing list