DIP 11: trial partial implementation
Adam D. Ruppe
destructionator at gmail.com
Sat Jun 18 17:10:52 PDT 2011
http://arsdnet.net/dcode/build2.d
To compile: dmd build2
To use: build2 [args like you'd pass to dmd...]
This is very similar to my existing build.d, but makes fewer
assumptions about me, instead opting to try to follow the DIP 11
design.
We should be able to build off this to an almost fully functional
prototype going to test the idea before touching the compiler at all.
Even the pragmas (almost) work as defined.
I've not throughly tested it, but it ought to work on all operating
systems (note: I've only tested on linux)
without dependencies with the following features:
* Downloading from simple http servers. No compression, no encryption
at this time.
* It pre-processes dmd arguments for the -I paths described in the
wiki and tries downloads to a local directory.
build2 mymodule -Ihttp://myrepository.com/d
The selective paths should work too but I haven't tested them yet.
* It adds some support for modules downloaded directly from the web.
build2 mymodule http://myrepisotory.com/d/file.d
* Arguments it doesn't care about are passed unchanged to dmd.
* Pass -ignore to the build process and you can do
pragma(importpath, "webpath");
as described in the wiki, with one change: the wiki says it should
be only for the current file. I can't find a way to do that outside
the compiler... dmd -v doesn't tell you what file the pragma came from.
* Automatically links .d files when doing a build at once, tries to
not break or slow down incremental builds
* Kinda simulates the idea of an external tool via a D function. See
Tuple!(int, string) dget(string, string) in the source.
* Has a simple cache - if the file is there already, use it.
* If a downloaded module requires another, it keeps going
What it doesn't attempt to do:
* Be fast. It loops dmd like my old build.d. (I can't find a better
way to do it. Even rdmd always runs dmd at least twice - check
its source!)
* Other protocols other than basic http, and it doesn't even support
redirects yet. I wanted zero dependency so I very quickly spun my
own downloader... it's fairly basic.
* Any kind of archives, yet.
* __FILE__ is the same.
* The output is ugly including repeated errors and debug info.
* It makes no attempt to hash the files since the wiki didn't decide
on a syntax.
* See FIXME comments in the source for some specifics
More information about the Digitalmars-d
mailing list