Attempt to get rid of phobos Makefiles, using reggae

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 29 03:35:33 PDT 2015


On Friday, 5 June 2015 at 19:17:14 UTC, Steven Schveighoffer 
wrote:
> On 6/5/15 11:03 AM, Atila Neves wrote:
>> On Friday, 5 June 2015 at 09:22:14 UTC, Jacob Carlborg wrote:
>>> On 2015-06-04 23:50, Atila Neves wrote:
>>>> http://dpaste.dzfl.pl/562f1ddc1aad
>>>
>>> Reggae doesn't support shell globbing of files? Something 
>>> like:
>>>
>>> ExcludeFiles(["std/c/windows/**/*.d"]);
>>
>> Not right now, no. The good thing about how it's designed is 
>> you could
>> write your own. Of course, the whole point is to have usable 
>> high-level
>> builtins as well. It's a good idea, but like I said before, I 
>> hardly
>> ever have to exclude anything in my own projects. Feel free to 
>> open an
>> enhancement request.
>
> This sounds like a job for CAPTAIN RANGE!!!
>
> Seriously though, the thought of using ranges to allow 
> specifying files fits perfectly. Imagine the power!
>
> "std/c/windows/".allSubFiles.filter!(a => a.name.extension == 
> ".d");
>
> Need that allSubFiles range, it probably already exists :)
>
> -Steve

So, given the range input, I realised that trying to accomodate 
what every user would never need when selecting source files, 
instead... I settled on this:

Sources!(["dir1, "dir2"]) //or
Sources!(Dirs(["dir1", "dir2"),
          Files(["extrafile1.d", "extrafile2.d"]),
          Filter!(a => ...));

Simple. Define source directories, define extra files, filter 
whatever isn't wanted out. Why reinvent the wheel when D already 
has pretty good wheels?


The result of all this (and many bug discoveries trying to copy 
posix.mak) is this:

https://github.com/atilaneves/phobos/blob/reggae/reggaefile.d

It doesn't completely replicate the UT build with its shared 
library (I got lazy), but... right now it builds both static and 
shard phobos, creates the symlinks just like posix.mak, _and_ 
does both unit tests runs (debug and release), building the unit 
tests binaries in the process. Oh, and the html documentation 
too. I tested with the make, ninja and binary backends, and 
everything seems to work. I wouldn't be surprised if there are 
still bugs, especially with the binary backend.

Worth making a PR for? The PR would only add this file, it 
wouldn't change anything about the current build, but could be 
used for testing purposes in the meanwhile.

Oh, and given the manual filtering in the config, it obviously 
won't work on Mac OS. I have to get a hold of a Mac and make it 
work there too. Then... Windows.

Atila





More information about the Digitalmars-d mailing list