Add '--dmd' and '--dc' to print the path of the installed compiler#297
Add '--dmd' and '--dc' to print the path of the installed compiler#297dlang-bot merged 1 commit intodlang:masterfrom
Conversation
|
Thanks for your pull request, @wilzbach! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
|
My questions seem to have got lost with the updated patch. I'll summarize: why make The simplest solution would probably be that Then, if in some script it's wanted that a compiler be installed if not found, that could be implemented by querying |
No worries. They weren't lost. I was about to reply to them.
The updated patch removed I hppe this answers all your questions as |
|
I'm not sure it really feels like the right answer. Could we take a pause on this and revisit tomorrow? I need some sleep ;-) I don't think it really satisfies what I see as my use-case. I would say that there are 2 different options that would satisfy what I'm looking for:
Bottom line, I like the idea of the |
No worries. There's quite a bottleneck for
I'm not sure what's your use case, but it satisfies the need for DMD:Previously: Now toolsnow:
Not a huge fan of this. It's also more complicated than this PR.
How would that work with |
|
On thinking it over: yes, as a flag to A separate Something that's not clear from your above examples: would the result be the directory where the compiler lives, or the full path to the compiler executable? I ask because: versus ... do not seem implicitly to be the same thing. After all, with LDC and GDC there are two compiler executables installed, with 2 different names ( |
script/install.sh
Outdated
| log " | ||
| Run \`source $ROOT/$2/activate${suffix:-}\` in your shell to use $2. | ||
| This will se tup PATH, LIBRARY_PATH, LD_LIBRARY_PATH, DMD, DC, and PS1. | ||
| Run \`deacti vate\` later on to restore your environment." |
There was a problem hiding this comment.
What's the reason for the weird whitespace on these lines?
c234904 to
7ad4054
Compare
Contrary to the previous changelog entry, they were doing the same thing ( However, after thinking about this, I think I found an even better solution with |
changelog/install-dmd-dc.dd
Outdated
|
|
||
| $(H4 Examples) | ||
|
|
||
| $(CONSOLE curl https://dlang.org/install.sh | bash -s --dmd |
There was a problem hiding this comment.
Not sure it's really helpful to put in this curl stuff. It distracts from the example of how to use the install.sh script itself.
There was a problem hiding this comment.
It's how you get the installer script and would use it for a CI script.
It also provides a seamless experience for readers who want to try out the new flags as they can just copy/paste the command.
There was a problem hiding this comment.
Sure, but it would be clearer if the example was annotated to that effect, e.g. download and run install script, printing out the installed compiler.
changelog/install-dmd-dc.dd
Outdated
| print information about the installed compiler binary: | ||
|
|
||
| $(UL | ||
| $(LI `--dmd` returns the path of a specific compiler executable (DMD-like interface)) |
There was a problem hiding this comment.
What will this be if the compiler does not expose a DMD-like interface?
There was a problem hiding this comment.
I don't think SDC will grow into a full compiler any time soon and even if, for a seamless experience it most likely will implement the DMD interface (IIRC it already does so).
The same applies for other compilers and if there's ever a case in a far far far distant future where we would want to include a new compiler, but are too lazy to wrap the DMD interface around it, fatal error is the Unix way.
Also as mentioned this is the changelog entry - not the documentation, so imho there's no need to go into details here.
There was a problem hiding this comment.
Also as mentioned this is the changelog entry - not the documentation, so imho there's no need to go into details here.
I didn't ask for the changelog to be altered. I asked what the result will be if the compiler does not expose a DMD-like interface.
There was a problem hiding this comment.
This can't happen as install.sh only supports GDC, DMD and SDC. If there's ever a new compiler which would be added to install.sh, it would fail, I presume.
script/install.sh
Outdated
|
|
||
| -a --activate Only print the path to the activate script | ||
| --dmd Only print the path to the compiler binary (e.g. dmd, ldmd2, gdmd) | ||
| --dc Only print the path to the compiler binary (e.g. dmd, ldc, gdc) |
There was a problem hiding this comment.
-
What will happen if I use both
--dmdand--dctogether? -
It looks like this documentation could be clearer about the distinction between the flags, i.e. that one is for the DMD-alike compiler binary
There was a problem hiding this comment.
Yep, conceptually these are actions, not flags.
Sorry, I've only grokked part of the discussion. Just using the compiler without the environment is not reliable, as the sc.ini/dmd.conf in your user home take precendence over the ones next to the compiler binary :/. |
Urgh I wasn't even aware of this. Let's fix this mess then -> dlang/dmd#7915
The idea is to have a
Well, that wouldn't be a huge problem for CIs (the main motivation for this feature), but of course one could always do sth. like this with DMD=$(~/dlang/install.sh 2.078.3 --dmd)
make DMD="$DMD" DFLAGS="-conf="$(dirname "$DMD")/dmd.conf)"In any case the motivation was that |
CyberShadow
left a comment
There was a problem hiding this comment.
Good idea except for the flag/action confusion.
Instead of install.sh install --dc, install.sh get-dc-path --install seems more logical.
changelog/install-dmd-dc.dd
Outdated
| @@ -0,0 +1,27 @@ | |||
| `~/dlang/install.sh` now supports `--dmd` and `--dc` | |||
There was a problem hiding this comment.
These are not options, they're actions. They should be named "get-dmd-path" and "get-dc-path" OSLT.
Am I missing something?
script/install.sh
Outdated
|
|
||
| -a --activate Only print the path to the activate script | ||
| --dmd Only print the path to the compiler binary (e.g. dmd, ldmd2, gdmd) | ||
| --dc Only print the path to the compiler binary (e.g. dmd, ldc, gdc) |
There was a problem hiding this comment.
Yep, conceptually these are actions, not flags.
|
@wilzbach @WebDrake @joseph-wakeling-sociomantic @CyberShadow @MartinNowak What is the current stand on this? Is there actually something preventing this from being merged? With the exception of the requested change from "--dmd" and "--dc" to "get-dmd-path" and "get-dc-path" all other concerns appears to have been addressed. @wilzbach can you address @CyberShadow's concern and resolve the conflicts to prepare this for merger? @MartinNowak, what other concerns if any do you have about this pull request? |
9cc5e54 to
b89c279
Compare
Ok. I reworked it. I combined them under a single |
|
Is it possible to remove those annoying CodeCov annotations? They make the diff unreadable. |
|
I see what you mean. Sorry, not sure how to do that. I'll defer to @wilzbach. |
for (var n of document.querySelectorAll('.check-annotation')) n.parentElement.remove(n);in the console does it. |
|
Ah, thanks. I missed that. That's much simpler. |
CyberShadow
left a comment
There was a problem hiding this comment.
Thank you. Good work on the thorough test script.
| actual="$1" | ||
| expected="$2" | ||
| if [ "$actual" != "$expected" ] ; then | ||
| echo "Actual: $actual" | ||
| echo "Expected: $expected" | ||
| exit 1 | ||
| fi |
There was a problem hiding this comment.
For this I would simply write diff -u <(cat <<< "$1") <(cat <<< "$2"), but this is OK too.
|
Wow. I didn't think this would ever get merged. Thanks! I opened a documentation PR -> dlang/dlang.org#2849 |

This has come up frequently in the past.
Use case: one has a generic compiler variable like
$DMDin a CI script and wants to use the install script without activating the environment.See also:
I'm not fully convinced about the name, so bike-shedding is allowed.
An alternative to this would have been to add a flag similar to
-a|--activate.That would require a two line change and would be fine for me too.
CC @WebDrake