rund users welcome

Jonathan Marler johnnymarler at gmail.com
Wed Sep 12 13:23:36 UTC 2018


On Wednesday, 12 September 2018 at 10:06:29 UTC, aliak wrote:
> On Wednesday, 12 September 2018 at 01:11:59 UTC, Jonathan 
> Marler wrote:
>> On Tuesday, 11 September 2018 at 19:55:33 UTC, Andre Pany 
>> wrote:
>>> On Saturday, 8 September 2018 at 04:24:20 UTC, Jonathan 
>>> Marler wrote:
>>>> I've rewritten rdmd into a new tool called "rund" and have 
>>>> been using it for about 4 months. It runs about twice as 
>>>> fast making my workflow much "snappier". It also introduces 
>>>> a new feature called "source directives" where you can add 
>>>> special comments to the beginning of your D code to set 
>>>> various compiler options like import paths, versions, 
>>>> environment variable etc.  Feel free to use it, test it, 
>>>> provide feedback, contribute.
>>>>
>>>> https://github.com/marler8997/rund
>>>
>>> It would be great if you could create a pull request for rdmd 
>>> to add the missing -i enhancement.
>>>
>>> Kind regards
>>> Andre
>>
>> I did :)
>>
>> https://github.com/dlang/tools/pull/292
>
> Made me sad to read that and related PRs ... sigh :(

Yeah I loved working on D.  But some of the people made it very 
difficult.  So I've switched focus to other projects that use D 
rather than contributing to D itself.

>
> But anyway! rund seems awesome! Thanks for it :) some questions:
>
> Are these all the compiler directives that are supported (was 
> not sure if they were an example or some of them or all of them 
> from the readme):
>
> #!/usr/bin/env rund
> //!importPath <path>
> //!version <version>
> //!library <library_file>
> //!importFilenamePath <path>
> //!env <var>=<value>
> //!noConfigFile
> //!betterC
>
> I love the concept of source files specifying the compiler 
> flags they need to build.
>

Yeah they have proven to be very useful. I have many tools 
written in D and this feature allows the main source file to be a 
"self-contained" program.  The source itself is declaring the 
libraries it needs, the environment, etc. And the answer is Yes, 
all those options are supported along with a couple I recently 
added `//!debug` and `//!debugSymbols`.  I anticipate more will 
be added in the future (see 
https://github.com/marler8997/rund/blob/master/src/rund/directives.d)

To show how powerful they are, I include an example in the 
repository that can actually build DMD on the fly (assuming the 
c++ libraries are built beforehand).

https://github.com/marler8997/rund/blob/master/test/dmdwrapper.d
----------------------------------------------------------------
#!/usr/bin/env rund
//!env CC=c++
//!version MARS
//!importPath ../../dmd/src
//!importFilenamePath ../../dmd/res
//!importFilenamePath ../../dmd/generated/linux/release/64
//!library ../../dmd/generated/linux/release/64/newdelete.o
//!library ../../dmd/generated/linux/release/64/backend.a
//!library ../../dmd/generated/linux/release/64/lexer.a

/*
This wrapper can be used to compile/run dmd (with some caveats).
* You need to have the dmd repository cloned to "../../dmd" 
(relative to this file).
* You need to have built the C libraries.  You can build these 
libraries by building dmd.
Note sure why, but through trial and error I determined that this 
is the
minimum set of modules that I needed to import in order to 
successfully
include all of the symbols to compile/link dmd.
*/
import dmd.eh;
import dmd.dmsc;
import dmd.toobj;
import dmd.iasm;
----------------------------------------------------------------

Thanks for the interest.  Feel free to post any requested 
features or issues on github.



More information about the Digitalmars-d mailing list