-
-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add '--dmd' and '--dc' to print the path of the installed compiler #297
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
tools
now:
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will this be if the compiler does not expose a DMD-like interface?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -192,6 +195,8 @@ Description | |||
Options | |||
|
|||
-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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
What will happen if I use both
--dmd
and--dc
together? -
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -192,6 +195,8 @@ Description | |||
Options | |||
|
|||
-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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
$DMD
in 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