-
Notifications
You must be signed in to change notification settings - Fork 412
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
Extend (:include )
to anything that looks like a flag
#153
Conversation
/cc @samoht |
src/module_compilation.ml
Outdated
; cmt_args | ||
; Dyn Lib.include_flags | ||
; Dyn (fun (include_flags, _) -> Lib.include_flags include_flags) |
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 should say fun (libs, _) -> ...
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.
Oops - changed!
Thanks, yh I agree that this should go in 1.0.0 as it unifies the format of the various
Also I think |
I'll have a look later - temporarily paused by a lack of lithium ions :) |
aa6cf7a
to
b537f72
Compare
That should be the |
293f4fa
to
e46171a
Compare
(:include )
to flags
, ocamlc_flags
and ocamlopt_flags
(:include )
to anything that looks like a flag
@diml - what strategy should I adopt for having both |
@dra27 I think the right way to do that is to change
|
8cf87eb
to
1caa583
Compare
@diml - thanks! Rebased (original commits unchanged). I've switched (hopefully correctly) both expanded and unexpanded sets to use an AST internally. Rather than introduce a third kind of set ( |
src/gen_rules.ml
Outdated
match force_custom_bytecode, Context.compiler ctx mode with | ||
| false, Some compiler -> (mode, link_flags, compiler) | ||
| _ -> (Byte, "-custom" :: link_flags, ctx.ocamlc) | ||
| false, Some compiler -> (mode, (fun x -> x), compiler) |
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 think link_custom
should just be a list, either []
or ["-custom"]
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'll do anything to avoid an @
😉 Changed!
(libs_and_cm >>> | ||
(libs_and_cm | ||
&&& | ||
Build.fanout |
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.
Build.fanout3
?
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 allowed fewer underscores later on... if we were going to flatten it completely, we'd really need Build.fanout4
- is that worth adding? (cf. a few lines later at Build.run
)
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.
Hmm, yh that's true, libs_and_cm
is already a pair. Let's not bother
src/ordered_set_lang.ml
Outdated
@@ -1,40 +1,59 @@ | |||
open! Import | |||
|
|||
type t = Sexp.Ast.t | |||
type expanded | |||
type unexpanded |
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 think in general it's recommended to do:
type expanded = Expanded
type unexpanded = Unexpanded
to make it clear that the two types are distinct. I think here it's fine as the types are only used inside this module, but we might as well use the canonical thing.
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.
Changed.
src/ordered_set_lang.ml
Outdated
let t t : t = parse_general t ~f:(function Atom (_, s) -> s | List _ -> assert false) | ||
|
||
let eval t ~special_values = | ||
let rec of_sexp (t : t) = |
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 shouldn't be called of_sexp
anymore
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.
Renamed to of_ast
src/ordered_set_lang.ml
Outdated
in | ||
of_sexp t | ||
|
||
let is_standard : t -> bool = function | ||
| Atom (_, ":standard") -> true | ||
| Ast.Element ":standard" -> true |
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.
shouldn't this be Ast.Special (_, "standard")
?
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.
Whoops!
Ok, seems good, I just a added a few minor comments |
flags, ocaml_flags and ocamlopt_flags now support the (:include ) form of the ordered set language.
Rebased and points addressed (except |
Extend Ordered_set_lang.Unexpanded.expand to include a mapping function for the S-expression for each atom. The previous behaviour can be achieved with ~f:Sexp.Of_sexp.string, but this allows the S-expression to be parsed using String_with_vars.t, thus allowing variable expansion.
library_flags already included variable expansion.
Ok, looks good, thanks! |
With this PR, is it expected for e.g.
|
@jberdine that exception looks pretty concerning. But I think you meant |
I think I tried both forms. IIUC, the docs indicate either should work: http://jbuilder.readthedocs.io/en/latest/jbuild.html#variables-expansion |
@jberdine, @rgrinberg - addressing the unacceptable exception first! You needed to quote the filename because you're in an S-expression but used brackets. |
Cross-referencing @rgrinberg's change in #231 |
As per the title - with thanks and due credit to @diml for patient pointers through the internals of jbuilder!
Longer term the aim is to also extend
${read ...}
forms from the action DSL, but this is a necessary first step, and possibly the${read ...}
change should be for 1.1 anyway?It would be very good to have this in 1.0 - I shall be experimenting with it later to convert some of my OCaml Syntax jbuild files back to s-expression only.