-
Notifications
You must be signed in to change notification settings - Fork 409
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
Let "concat" or "split" be a quality of the variable #336
Conversation
One could imagine that split variables say what is their separator so, say, |
From a first glance, the implementation here looks good. Though I'm not yet sure why is this feature necessary and where it can be useful. A couple of minor nits:
|
This is an alternative solution to #300 |
I did but it changed lines I did not modify. I made it a separate commit so it is easily revertible. |
I reverted the single line affected by this (and merged it with the original commit). |
Actually, the logical sequel to this change is to put a warning when using |
I had a look at this PR. I just like to say that I'm a bit ashamed of the One reason I didn't do this earlier is that I'm a bit nervous about this: let cflags = String.extract_blank_separated_words context.ocamlc_cflags in
In the end, I would still like to see this PR merged. It's unlikely that such So before we merge it, I'd like to know two things:
The only case of breakage I can think of is the following:
The fix is easy: just write |
A quick grep on the jbuilder-universe shows that very few packages use
None of these uses is problematic with the new behavior. |
I can provided nobody is in a hurry — I may not be able to react within a week. I may also need help to test the Windows side (I so not have a readily available Windows machine). |
src/super_context.ml
Outdated
let make = | ||
match Bin.make with | ||
| None -> "make" | ||
| Some p -> Path.to_string p | ||
| None -> Paths ([Path.of_string "make"], Split) |
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 needs to be Strings, otherwise jbuilder is going to think it's the file "make" in the current dir and expand it to ./make
Ok, thanks. After the discussion on slack I'm less worried about this anyway. Could you update the doc as well? |
c65f1a2
to
d6bd318
Compare
I updated the code following your remarks — and more :-) |
This requires ${CC} to be a split variable, see ocaml/dune#336
doc/jbuild.rst
Outdated
|
||
.. code:: scheme | ||
|
||
(run foo "${^}") |
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 is not true at the moment. The double quotes are only seen by the lexer. From the point of view of jbuilder, hello
and "hello"
are exactly the same atom.
We could change jbuilder to keep this information and do different things according to whether atoms are quoted or not. This might make sense given that the syntax is different from the user point of view. However, we should have this discussion in a different ticket to avoid delaying this PR.
For now, the user has to add a space at the beginning or end of the atom:
(run foo "${^} ")
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.
Opened #408
src/super_context.ml
Outdated
let has_bang, var = parse_bang key in | ||
if has_bang then | ||
Format.eprintf "@{<warning>Warning@}: The use of the variable \ | ||
prefix '!' is deprecated, simply use '${%s}'@." var; |
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.
Can you use Loc.warn loc "The use ..."
?
src/super_context.ml
Outdated
(* CR-someday jdimino: this should be an error *) | ||
Strings ([""], cos) | ||
Format.eprintf "@{<warning>Warning@}: Variable '<' used with \ | ||
no explicit dependencies@."; |
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.
Same remark about Loc.warn
Thanks, I left some minor comment but otherwise it looks ready |
To concatenate the contents of a split variable, put it in a string: "${var}". Fixes ocaml#300
Also fixed the conflicts. |
Thanks |
No description provided.