-
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
Environment & build profiles #419
Conversation
What is an |
It represent the environment in a given directory. I haven't written the details yet, but the idea an environment is attached to every directory. It is inherit from the parent up to the root of the current scope, where the global default environment is used. To know the value of a variable, one must look at |
src/ocaml_flags.ml
Outdated
@@ -22,7 +22,7 @@ let dev_mode_warnings = | |||
]) | |||
|
|||
let default_flags () = | |||
if !Clflags.dev_mode then | |||
if !Clflags.profile = "dev" then |
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.
You have the dev_mode function now.
I'm wondering if this feature shouldn't be a bit more generic with just a toplevel
and to do different things according to the profile, we could have generic constructions:
This could subsume #397:
|
I like the more general approach here. How are profile will be different from any other variable then? Just the fact that we can set them in the command line? |
Yh, also maybe we'll be able to set other things from the command line. We should probably disallow changing the profile in a |
bin/main.ml
Outdated
| true , None -> `Ok (Some "dev") | ||
| true , Some _ -> | ||
`Error (true, | ||
"Cannot use -dev and --profile simultaneously") |
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.
--dev
missing a dash.
doc/quick-start.rst
Outdated
|
||
.. code:: scheme | ||
|
||
(profile 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.
Can we select the build profile per context?
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.
Yes, I started a patch for it, I'm not sure I pushed it though
Let me know at any point if you could use some alpha testing of this. (I tried from this branch, but it seems to have fallen a bit far behind.) |
I think what stopped this feature was more a design question. However, it might take quite a lot more time to design and implement something better and not being able to change the defaults is quite annoying. I guess we could start with this PR since it solves the problem. It's simple so it shouldn't be too hard to be backward compatible if we decide to change the system later. I'll rebase it, some testing would be welcome indeed. |
I rebased and finished this PR. |
String.Map.map map ~f:snd | ||
(String_map.map map ~f:(fun (module M : Gen) -> M.gen_rules)); | ||
String_map.iter map ~f:(fun (module M : Gen) -> M.init ()); | ||
String_map.map map ~f:(fun (module M : Gen) -> M.sctx) |
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.
Wondering if this is the result of a rebase accident.
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 correct, basically for the printenv
command we need to access the super context. So instead of keeping the stanzas, we just keep the whole super contexts now.
Yeah, that is fine. Just wondering why you brought back the String_map.
…On Thu, May 3, 2018, 5:53 PM Jérémie Dimino ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/gen_rules.ml
<#419 (comment)>:
> in
Fiber.parallel_map contexts ~f:make_sctx >>| fun l ->
let map = String.Map.of_list_exn l in
Build_system.set_rule_generators build_system
- (String.Map.map map ~f:(fun ((module M : Gen), _) -> M.gen_rules));
- String.Map.iter map ~f:(fun ((module M : Gen), _) -> M.init ());
- String.Map.map map ~f:snd
+ (String_map.map map ~f:(fun (module M : Gen) -> M.gen_rules));
+ String_map.iter map ~f:(fun (module M : Gen) -> M.init ());
+ String_map.map map ~f:(fun (module M : Gen) -> M.sctx)
This is correct, basically for the printenv command we need to access the
super context. So instead of keeping the stanzas, we just keep the whole
super contexts now.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAIe-30vHQdB_5VWxBRiEqDHf59dmQiRks5tuuHCgaJpZM4RgOss>
.
|
Ah, I guess it's because there is still a |
Actually it's a bit annoying as it's still used by many pretty-printers. I added a commit to make sure |
Nice, this is working for me. One step closer to being able to use sexp jbuild files! I don't know if it's difficult or leads down the slippery slope to hard design questions, but I wanted to write:
in order to eliminate code in jbuild that detects if bisect_ppx is installed. |
Additionally, it would be useful to be able to use
Or even allow including whole (lists of) stanzas:
This is not a big deal, as it's not hard to cat some files together to generate the jbuild files, but direct support would make it tidier. |
The environment is inherited from the parent directory, up to the root of the current scope (project). So you should only need to write it once in a toplevel Regarding |
Preview of simplifications enabled by ocaml/dune#419
Configuration:
(env (release (flags (:standard -O3))) (foo (flags (:standard -w +a))))
usage: