Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
February 10, 2020 Tip: Use -i to modify druntime/phobos without rebuilding them | ||||
---|---|---|---|---|
| ||||
Yesterday I wanted to test out some small changes to phobos. Rather than building and installing my own version of the compiler and libraries, I used a quick hack that allowed me to directly change the druntime/phobos source files from my current installation and see the results immediately. In this case I was playing with the "std.process" module in phobos. I created a backup of src/phobos/std/process.d and started making changes. All I needed to do in order to see these changes in my program was to include the "-i=std.process" option like this: dmd -i=std.process myapp.d A quick and dirty way to selectively change and test changes to phobos/druntime on any installed compiler. For those not familair with -i, the reason this works is that the "-i" flag causes all imports to be compiled, except for those under the "core", "std" and "etc" module namespaces. However, you can override this by explicitly including any one of those namespaces. |
February 09, 2020 Re: Tip: Use -i to modify druntime/phobos without rebuilding them | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan Marler | On Sun, Feb 9, 2020 at 10:20 PM Jonathan Marler via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
>
> Yesterday I wanted to test out some small changes to phobos. Rather than building and installing my own version of the compiler and libraries, I used a quick hack that allowed me to directly change the druntime/phobos source files from my current installation and see the results immediately.
>
> In this case I was playing with the "std.process" module in phobos. I created a backup of src/phobos/std/process.d and started making changes. All I needed to do in order to see these changes in my program was to include the "-i=std.process" option like this:
>
> dmd -i=std.process myapp.d
>
> A quick and dirty way to selectively change and test changes to phobos/druntime on any installed compiler.
>
> For those not familair with -i, the reason this works is that the "-i" flag causes all imports to be compiled, except for those under the "core", "std" and "etc" module namespaces. However, you can override this by explicitly including any one of those namespaces.
Oh wow, cool tip! I never thought of that!
|
February 10, 2020 Re: Tip: Use -i to modify druntime/phobos without rebuilding them | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan Marler | On Monday, 10 February 2020 at 06:19:44 UTC, Jonathan Marler wrote:
> Yesterday I wanted to test out some small changes to phobos. Rather than building and installing my own version of the compiler and libraries, I used a quick hack that allowed me to directly change the druntime/phobos source files from my current installation and see the results immediately.
>
> In this case I was playing with the "std.process" module in phobos. I created a backup of src/phobos/std/process.d and started making changes. All I needed to do in order to see these changes in my program was to include the "-i=std.process" option like this:
>
> dmd -i=std.process myapp.d
>
> A quick and dirty way to selectively change and test changes to phobos/druntime on any installed compiler.
>
> For those not familair with -i, the reason this works is that the "-i" flag causes all imports to be compiled, except for those under the "core", "std" and "etc" module namespaces. However, you can override this by explicitly including any one of those namespaces.
Doesn't that only work for specific cases involving templates though ?
If you don't recompile Phobos, anything you'll link will still link the old binaries. So it's akin to compiling C(++) code but having the headers not match the `.c(pp)`.
|
February 10, 2020 Re: Tip: Use -i to modify druntime/phobos without rebuilding them | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mathias Lang | On 10/02/2020 8:03 PM, Mathias Lang wrote:
> On Monday, 10 February 2020 at 06:19:44 UTC, Jonathan Marler wrote:
>> Yesterday I wanted to test out some small changes to phobos. Rather than building and installing my own version of the compiler and libraries, I used a quick hack that allowed me to directly change the druntime/phobos source files from my current installation and see the results immediately.
>>
>> In this case I was playing with the "std.process" module in phobos. I created a backup of src/phobos/std/process.d and started making changes. All I needed to do in order to see these changes in my program was to include the "-i=std.process" option like this:
>>
>> dmd -i=std.process myapp.d
>>
>> A quick and dirty way to selectively change and test changes to phobos/druntime on any installed compiler.
>>
>> For those not familair with -i, the reason this works is that the "-i" flag causes all imports to be compiled, except for those under the "core", "std" and "etc" module namespaces. However, you can override this by explicitly including any one of those namespaces.
>
> Doesn't that only work for specific cases involving templates though ?
> If you don't recompile Phobos, anything you'll link will still link the old binaries. So it's akin to compiling C(++) code but having the headers not match the `.c(pp)`.
-i != -I
|
February 10, 2020 Re: Tip: Use -i to modify druntime/phobos without rebuilding them | ||||
---|---|---|---|---|
| ||||
Posted in reply to rikki cattermole | On Monday, 10 February 2020 at 07:17:11 UTC, rikki cattermole wrote:
> On 10/02/2020 8:03 PM, Mathias Lang wrote:
>> On Monday, 10 February 2020 at 06:19:44 UTC, Jonathan Marler wrote:
>>> [...]
>>
>> Doesn't that only work for specific cases involving templates though ?
>> If you don't recompile Phobos, anything you'll link will still link the old binaries. So it's akin to compiling C(++) code but having the headers not match the `.c(pp)`.
>
> -i != -I
In C++ it would be akin to re-compiling all the source files that match your "-i" pattern, not just changing the header files. The case you're thinking of is the behavior you get when you don't specify -i.
|
February 10, 2020 Re: Tip: Use -i to modify druntime/phobos without rebuilding them | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan Marler | On Monday, 10 February 2020 at 06:19:44 UTC, Jonathan Marler wrote:
> dmd -i=std.process myapp.d
If you're doing an individual file too, you can specify it
dmd myapp.d /pat/to/modified/phobos/file.d
just specify it on the command line and it gets recompiled in.
That's what -i is doing on the inside of course just it might be easier to specify the one file in certain cases.
|
Copyright © 1999-2021 by the D Language Foundation