-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merlin: add new contexts commands (#10324)
* merlin: add rules regardless of (merlin) Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * merlin: update tests Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * merlin: add GetContexts command Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * merlin: add SetContexts (wip) Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * better tests Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * merlin: simpler get-set-contexts test Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * Revert "merlin: add rules regardless of (merlin)" This reverts commit 3d3c97f. Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * merlin: introduce generate_merlin_rules Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * add docs and changelog Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * merlin: roll back changes in default-based-context test Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * merlin: update get-set-contexts test Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * update changes Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * rename Standard to Default Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * merlin: rename Nothing to Not_selected Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * merlin: fix tests Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * describe: add contexts subcommand Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * merlin: replace get/set context with flag Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * merlin: cleanup Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * cleanup Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * merlin: remove context check Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * apply suggestions from code review Co-authored-by: Antonio Nuno Monteiro <anmonteiro@gmail.com> Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * gate generate_merlin_rules to 3.16 Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * merlin: add --context to dump_dot_merlin Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * apply suggestions from code review Co-authored-by: Antonio Nuno Monteiro <anmonteiro@gmail.com> Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * merlin: add Select_context.conv Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> * fix: promote tests after rebase Signed-off-by: Antonio Nuno Monteiro <anmonteiro@gmail.com> * refactor: remove `Selected_context.t`, reuse the context arg, use it in dump Signed-off-by: Antonio Nuno Monteiro <anmonteiro@gmail.com> --------- Signed-off-by: Javier Chávarri <javier.chavarri@gmail.com> Signed-off-by: Antonio Nuno Monteiro <anmonteiro@gmail.com> Co-authored-by: Antonio Nuno Monteiro <anmonteiro@gmail.com>
- Loading branch information
1 parent
02170fe
commit 0471f45
Showing
12 changed files
with
305 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
open Import | ||
|
||
let term = | ||
let+ builder = Common.Builder.term in | ||
let common, config = Common.init builder in | ||
Scheduler.go ~common ~config | ||
@@ fun () -> | ||
let open Fiber.O in | ||
let* setup = Import.Main.setup () in | ||
let+ setup = Memo.run setup in | ||
let ctxts = | ||
List.map | ||
~f:(fun (name, _) -> Context_name.to_string name) | ||
(Context_name.Map.to_list setup.scontexts) | ||
in | ||
List.iter ctxts ~f:print_endline | ||
;; | ||
|
||
let command = | ||
let doc = "List the build contexts available in the workspace." in | ||
let info = Cmd.info ~doc "contexts" in | ||
Cmd.v info term | ||
;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
open Import | ||
|
||
(** Dune command to print out the available build contexts.*) | ||
val command : unit Cmd.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- Add new flag `--context` to `dune ocaml-merlin`, which allows to select a Dune | ||
context when requesting Merlin config. Add `dune describe contexts` | ||
subcommand. Introduce a field `generate_merlin_rules` for contexts declared in | ||
the workspace, that allows to optionally produce Merlin rules for other | ||
contexts besides the one selected for Merlin (#10324, @jchavarri) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
test/blackbox-tests/test-cases/describe/describe-contexts.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Showcase behavior of the `dune describe contexts` subcommand | ||
|
||
$ cat >dune-project <<EOF | ||
> (lang dune 3.14) | ||
> EOF | ||
|
||
$ cat > dune-workspace << EOF | ||
> (lang dune 3.14) | ||
> | ||
> (context default) | ||
> | ||
> (context | ||
> (default | ||
> (name alt))) | ||
> EOF | ||
|
||
$ dune describe contexts | ||
alt | ||
default |
Oops, something went wrong.