www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - rund users welcome

reply Jonathan Marler <johnnymarler gmail.com> writes:
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
Sep 07 2018
next sibling parent "Nick Sabalausky (Abscissa)" <SeeWebsiteToContactMe semitwist.com> writes:
On 09/08/2018 12:24 AM, 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
 
Very cool!
Sep 08 2018
prev sibling next sibling parent reply Vladimir Panteleev <thecybershadow.lists gmail.com> writes:
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.
Thanks! I tried integrating it into my scripts as an rdmd replacement. Currently, the following are missing: - -od (e.g. for -od.) - --build-only should imply -od. - No --main, though that can probably be substituted with -main - The .d extension is not implied, like for dmd/rdmd Also, --pass is weird. Why not use the standard-ish -- ? Was there a problem with the idea of forking rdmd? The above plus things like its -lib support would then not be needed to be reimplemented.
Sep 08 2018
parent reply Jonathan Marler <johnnymarler gmail.com> writes:
On Sunday, 9 September 2018 at 03:33:49 UTC, Vladimir Panteleev 
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.
Thanks! I tried integrating it into my scripts as an rdmd replacement.
Cool thanks for giving it a try.
 Currently, the following are missing:

 - -od (e.g. for -od.)
Hmmm, yeah it looks like rund is currently overriding this. I've attempted a fix but it's hard to cover all the different combinations of -of/-od/etc. I'll need to fill out the rest of the tests soon.
 - --build-only should imply -od.
Maybe...I actually have use cases where I want "--build-only" but want the executable to be built in the normal cache location. Build the program and cache it but don't run it yet.
 - No --main, though that can probably be substituted with -main
Yeah, I don't see any reason to duplicate the flag already supported by dmd. Maybe there's a reason I'm not aware of.
 - The .d extension is not implied, like for dmd/rdmd
I haven't come up with any reasons to support this. Maybe you can enlighten me?
 Also, --pass is weird. Why not use the standard-ish -- ?
It is a bit weird. I've never had a reason to use this option myself. Is this the syntax you are thinking of? rund other.d main.d -- <program-args>... The problem with this is it's not "composable". Say you were running a D program that also used "--", then it's ambiguous whether the "--" belongs to rund or to the program being compiled. But maybe I'm missing something? If you have an idea that's less weird than "--pass=<src>.d" then I'm all for it :)
 Was there a problem with the idea of forking rdmd? The above 
 plus things like its -lib support would then not be needed to 
 be reimplemented.
I would actually consider this a "fork" of rdmd. But I rebuilt it from the ground up, re-integrating each feature one by one so I could ensure they were "cohesive". I also haven't integrated all features from rdmd yet. I will probably integrate more of them when I see the need. So far it's just been me using it so that's why I want to get people using it so we can flush out the rest. The big difference with rdmd and rund is that rund is not compatible with compilers that don't support "-i". Since this is such a fundamental change, I thought a rename made sense, and "rund" fits the modern times where we have more D compilers than just dmd.
Sep 08 2018
next sibling parent reply Vladimir Panteleev <thecybershadow.lists gmail.com> writes:
On Sunday, 9 September 2018 at 04:32:32 UTC, Jonathan Marler 
wrote:
 - --build-only should imply -od.
Maybe...I actually have use cases where I want "--build-only" but want the executable to be built in the normal cache location. Build the program and cache it but don't run it yet.
Adding a different switch to get rdmd's behavior would work too. FWIW, here's when this was added in rdmd: https://github.com/dlang/tools/pull/14 Later amended here (so it's not quite -od.): https://github.com/dlang/tools/commit/155e19c478260c2da6369715f48c201f53c8e45e
 - The .d extension is not implied, like for dmd/rdmd
I haven't come up with any reasons to support this. Maybe you can enlighten me?
"rund prog" is shorter and easier to type than "rund prog.d". I never invoke rdmd directly, though, so I guess I could add this to my wrapper scripts around rdmd/rund.
 Also, --pass is weird. Why not use the standard-ish -- ?
It is a bit weird. I've never had a reason to use this option myself. Is this the syntax you are thinking of? rund other.d main.d -- <program-args>... The problem with this is it's not "composable". Say you were running a D program that also used "--", then it's ambiguous whether the "--" belongs to rund or to the program being compiled. But maybe I'm missing something? If you have an idea that's less weird than "--pass=<src>.d" then I'm all for it :)
Well, the way rdmd works is that it stops looking at arguments once it sees the first non-option argument (i.e. an argument that doesn't start with -). As it happens, all relevant dmd arguments can be passed as one, i.e. "-opt=value" instead of "-opt value", so it can use this to cleanly separate arguments to itself/dmd from arguments to the program. I guess --pass can be useful if you want to include a .d file in the compilation that's not otherwise compiled (i.e. it's not imported from anywhere). This is currently not possible with rdmd, AFAIK.
 Was there a problem with the idea of forking rdmd? The above 
 plus things like its -lib support would then not be needed to 
 be reimplemented.
I would actually consider this a "fork" of rdmd. But I rebuilt it from the ground up, re-integrating each feature one by one so I could ensure they were "cohesive". I also haven't integrated all features from rdmd yet. I will probably integrate more of them when I see the need. So far it's just been me using it so that's why I want to get people using it so we can flush out the rest. The big difference with rdmd and rund is that rund is not compatible with compilers that don't support "-i". Since this is such a fundamental change, I thought a rename made sense, and "rund" fits the modern times where we have more D compilers than just dmd.
I see, thanks!
Sep 09 2018
parent Jonathan Marler <johnnymarler gmail.com> writes:
On Sunday, 9 September 2018 at 09:55:19 UTC, Vladimir Panteleev 
wrote:
 On Sunday, 9 September 2018 at 04:32:32 UTC, Jonathan Marler
 - The .d extension is not implied, like for dmd/rdmd
I haven't come up with any reasons to support this. Maybe you can enlighten me?
"rund prog" is shorter and easier to type than "rund prog.d".
Support main source with no extension: https://github.com/marler8997/rund/pull/1
Sep 09 2018
prev sibling next sibling parent "Nick Sabalausky (Abscissa)" <SeeWebsiteToContactMe semitwist.com> writes:
On 09/09/2018 12:32 AM, Jonathan Marler wrote:
 On Sunday, 9 September 2018 at 03:33:49 UTC, Vladimir Panteleev wrote:
 - No --main, though that can probably be substituted with -main
Yeah, I don't see any reason to duplicate the flag already supported by dmd.  Maybe there's a reason I'm not aware of.
I'm pretty sure rdmd's --main is just a historical thing, from back before -main was built into the compiler itself.
Sep 09 2018
prev sibling parent reply Vladimir Panteleev <thecybershadow.lists gmail.com> writes:
On Sunday, 9 September 2018 at 04:32:32 UTC, Jonathan Marler 
wrote:
 - -od (e.g. for -od.)
Hmmm, yeah it looks like rund is currently overriding this. I've attempted a fix but it's hard to cover all the different combinations of -of/-od/etc. I'll need to fill out the rest of the tests soon.
Thanks. Looks like there's a problem on Posix systems: With -od., the binary file doesn't have the executable bit set. This fixes it: std.file.copy(from, to, std.file.PreserveAttributes.yes); Why not just get the compiler to create the file at the correct location directly, and avoid the I/O of copying the file?
Sep 10 2018
parent Jonathan Marler <johnnymarler gmail.com> writes:
On Tuesday, 11 September 2018 at 01:02:30 UTC, Vladimir Panteleev 
wrote:
 On Sunday, 9 September 2018 at 04:32:32 UTC, Jonathan Marler 
 wrote:
 - -od (e.g. for -od.)
Hmmm, yeah it looks like rund is currently overriding this. I've attempted a fix but it's hard to cover all the different combinations of -of/-od/etc. I'll need to fill out the rest of the tests soon.
Thanks. Looks like there's a problem on Posix systems: With -od., the binary file doesn't have the executable bit set. This fixes it: std.file.copy(from, to, std.file.PreserveAttributes.yes);
I wasn't able to reproduce this issue on my ubuntu box. But, this might not be an issue anymore because I've implemented your next suggestion...
 Why not just get the compiler to create the file at the correct 
 location directly, and avoid the I/O of copying the file?
https://github.com/marler8997/rund/pull/3 (Remove extra rename/copy when user gives -of) Reviews welcome
Sep 10 2018
prev sibling next sibling parent reply Kagamin <spam here.lot> writes:
On Saturday, 8 September 2018 at 04:24:20 UTC, Jonathan Marler 
wrote:
 https://github.com/marler8997/rund
I have an idea how to push shebang to userland and make it crossplatform: if, say, `rund -install prog.d` would copy/link itself into current folder under name "prog" and when run would work with file args[0]~".d", this will work the same on all platforms without shebang.
Sep 11 2018
parent reply Jonathan Marler <johnnymarler gmail.com> writes:
On Tuesday, 11 September 2018 at 08:53:46 UTC, Kagamin wrote:
 On Saturday, 8 September 2018 at 04:24:20 UTC, Jonathan Marler 
 wrote:
 https://github.com/marler8997/rund
I have an idea how to push shebang to userland and make it crossplatform: if, say, `rund -install prog.d` would copy/link itself into current folder under name "prog" and when run would work with file args[0]~".d", this will work the same on all platforms without shebang.
So your idea is that you could run `rund -install prog.d` which would create some sort of file that allows you to run `./prog` (on POSIX) or `prog` (on WINDOWS). So something like this: /path/prog.d Posix: /path/prog -> /usr/bin/rund Windows 10 (It supports symbolic links) /path/prog.exe -> C:\Programs\rund.exe Windows <10 /path/prog.exe (a copy of rund.exe) Then this would allow you to run "/path/prog" and which would invoke rund and like you said we could take "argv[0]" and assume that's the main source file. The Posix/Windows 10 cases seem fine, but Windows <10 is not great. In this case it has to keep an entire copy of rund around (currently 1.8M). I think we can do better. Instead, `rund -install prog.d` could generate a little "wrapper program" that forwards any calls to rund. You could make this wrapper program with a small D program, or with this BATCH script: --- /path/prog.bat rund %~dp0prog.d %* You get the same result. When you run "\path\prog" it will invoke rund with the given args for prog.d. Thoughts?
Sep 11 2018
parent reply Kagamin <spam here.lot> writes:
On Tuesday, 11 September 2018 at 15:20:51 UTC, Jonathan Marler 
wrote:
 The Posix/Windows 10 cases seem fine, but Windows <10 is not 
 great.
MSDN says symbolic links are supported since Vista.
Sep 11 2018
parent Jonathan Marler <johnnymarler gmail.com> writes:
On Tuesday, 11 September 2018 at 17:36:09 UTC, Kagamin wrote:
 On Tuesday, 11 September 2018 at 15:20:51 UTC, Jonathan Marler 
 wrote:
 The Posix/Windows 10 cases seem fine, but Windows <10 is not 
 great.
MSDN says symbolic links are supported since Vista.
Yeah but I think you need Admin privileges to make them.
Sep 11 2018
prev sibling parent reply Andre Pany <andre s-e-a-p.de> writes:
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
Sep 11 2018
parent reply Jonathan Marler <johnnymarler gmail.com> writes:
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 I spent quite a bit of time on it but in the end the bulk of my time was spent on what seemed to be endless debate rather than writing good code. After I decided to try forking rdmd my life got much better :) Now I spend my time writing great code, making good tests and having nice tools. I'm much happier working than I am arguing with people. What took me months to do with rdmd took me less than a day with my rund. So...if you have requests for rund features or issues by all means let me know, but I don't control rdmd and I've learned that time contributing to it is mostly time wasted.
Sep 11 2018
parent reply aliak <something something.com> writes:
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 :( 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): //!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. Cheers, - Ali
Sep 12 2018
parent reply Jonathan Marler <johnnymarler gmail.com> writes:
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):


 //!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 ---------------------------------------------------------------- //!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.
Sep 12 2018
parent reply aliak <something something.com> writes:
On Wednesday, 12 September 2018 at 13:23:36 UTC, Jonathan Marler 
wrote:
 On Wednesday, 12 September 2018 at 10:06:29 UTC, aliak wrote:
 [...]
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.
[...]
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 ---------------------------------------------------------------- //!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.
Somewhat along these lines, I just found a watched a video by a guy who's been working on a programming language called Jai (it has some awesome concepts) and one of the sections he went in to about source files building themselves I thought was interesting and reminded me of rund so thought I'd post here. Might inspire you to add some stuff to rund :) Video: https://www.youtube.com/watch?v=uZgbKrDEzAs Time in video on "getting rid of build tools": https://youtu.be/uZgbKrDEzAs?t=1849 Enjoy!
Sep 20 2018
parent Jonathan Marler <johnnymarler gmail.com> writes:
On Thursday, 20 September 2018 at 23:19:17 UTC, aliak wrote:
 Somewhat along these lines, I just found a watched a video by a 
 guy who's been working on a programming language called Jai (it 
 has some awesome concepts) and one of the sections he went in 
 to about source files building themselves I thought was 
 interesting and reminded me of rund so thought I'd post here. 
 Might inspire you to add some stuff to rund :)

 Video: https://www.youtube.com/watch?v=uZgbKrDEzAs
 Time in video on "getting rid of build tools": 
 https://youtu.be/uZgbKrDEzAs?t=1849

 Enjoy!
Yeah I'm very familair with Jai and Jonathan Blow :) I'm excited for him to release it, I've emailed him about contributing but haven't gotten much response from him yet.
Sep 20 2018