forked from ocaml/dune
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "dune describe package-entries" (ocaml#7480)
* Add "dune describe entries" The need is about knowing if a private executable is going to be installed before building the project. Signed-off-by: Alpha DIALLO <[email protected]> Co-authored-by: Etienne Millon <[email protected]>
- Loading branch information
1 parent
2e3b5f4
commit 9910cbb
Showing
10 changed files
with
281 additions
and
0 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
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+ common = Common.term | ||
and+ context_name = Common.context_arg ~doc:"Build context to use." | ||
and+ format = Describe_format.arg in | ||
let config = Common.init common in | ||
Scheduler.go ~common ~config @@ fun () -> | ||
let open Fiber.O in | ||
let* setup = Import.Main.setup () in | ||
let* setup = Memo.run setup in | ||
let super_context = Import.Main.find_scontext_exn setup ~name:context_name in | ||
Build_system.run_exn @@ fun () -> | ||
let open Memo.O in | ||
Dune_rules.Install_rules.stanzas_to_entries super_context | ||
>>| Package.Name.Map.to_dyn (fun entries -> | ||
Dyn.List (List.map ~f:Install.Entry.Sourced.to_dyn entries)) | ||
>>| Describe_format.print_dyn format | ||
|
||
let command = | ||
let doc = "prints information about the entries per package" in | ||
let info = Cmd.info ~doc "package-entries" 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 information about the entries per package.*) | ||
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
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
218 changes: 218 additions & 0 deletions
218
test/blackbox-tests/test-cases/describe-package-entries.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,218 @@ | ||
Test for the `dune describe package-entries` command | ||
|
||
$ cat >dune-project <<EOF | ||
> (lang dune 3.10) | ||
> (package | ||
> (name foo) | ||
> (synopsis "describe package-entries")) | ||
> (generate_opam_files) | ||
> EOF | ||
|
||
$ cat >dune <<EOF | ||
> (library | ||
> (public_name foo) | ||
> (modules foo)) | ||
> | ||
> (executable | ||
> (name main) | ||
> (libraries foo) | ||
> (modules main)) | ||
> | ||
> (install | ||
> (section bin) | ||
> (package foo) | ||
> (files main.exe)) | ||
> EOF | ||
|
||
$ touch main.ml | ||
$ touch foo.ml | ||
$ touch foo.opam | ||
|
||
$ dune describe package-entries | ||
((foo | ||
(((source Dune) | ||
(entry | ||
((src | ||
(In_build_dir default/META.foo)) | ||
(kind file) | ||
(dst META) | ||
(section LIB) | ||
(optional false)))) | ||
((source Dune) | ||
(entry | ||
((src | ||
(In_build_dir default/foo.dune-package)) | ||
(kind file) | ||
(dst dune-package) | ||
(section LIB) | ||
(optional false)))) | ||
((source | ||
(User | ||
((pos_fname dune) | ||
(start | ||
((pos_lnum 1) | ||
(pos_bol 0) | ||
(pos_cnum 0))) | ||
(stop | ||
((pos_lnum 3) | ||
(pos_bol 28) | ||
(pos_cnum 43)))))) | ||
(entry | ||
((src | ||
(In_build_dir default/foo.a)) | ||
(kind file) | ||
(dst foo.a) | ||
(section LIB) | ||
(optional false)))) | ||
((source | ||
(User | ||
((pos_fname dune) | ||
(start | ||
((pos_lnum 1) | ||
(pos_bol 0) | ||
(pos_cnum 0))) | ||
(stop | ||
((pos_lnum 3) | ||
(pos_bol 28) | ||
(pos_cnum 43)))))) | ||
(entry | ||
((src | ||
(In_build_dir default/foo.cma)) | ||
(kind file) | ||
(dst foo.cma) | ||
(section LIB) | ||
(optional false)))) | ||
((source | ||
(User | ||
((pos_fname dune) | ||
(start | ||
((pos_lnum 1) | ||
(pos_bol 0) | ||
(pos_cnum 0))) | ||
(stop | ||
((pos_lnum 3) | ||
(pos_bol 28) | ||
(pos_cnum 43)))))) | ||
(entry | ||
((src | ||
(In_build_dir default/.foo.objs/byte/foo.cmi)) | ||
(kind file) | ||
(dst foo.cmi) | ||
(section LIB) | ||
(optional false)))) | ||
((source | ||
(User | ||
((pos_fname dune) | ||
(start | ||
((pos_lnum 1) | ||
(pos_bol 0) | ||
(pos_cnum 0))) | ||
(stop | ||
((pos_lnum 3) | ||
(pos_bol 28) | ||
(pos_cnum 43)))))) | ||
(entry | ||
((src | ||
(In_build_dir default/.foo.objs/byte/foo.cmt)) | ||
(kind file) | ||
(dst foo.cmt) | ||
(section LIB) | ||
(optional false)))) | ||
((source | ||
(User | ||
((pos_fname dune) | ||
(start | ||
((pos_lnum 1) | ||
(pos_bol 0) | ||
(pos_cnum 0))) | ||
(stop | ||
((pos_lnum 3) | ||
(pos_bol 28) | ||
(pos_cnum 43)))))) | ||
(entry | ||
((src | ||
(In_build_dir default/.foo.objs/native/foo.cmx)) | ||
(kind file) | ||
(dst foo.cmx) | ||
(section LIB) | ||
(optional false)))) | ||
((source | ||
(User | ||
((pos_fname dune) | ||
(start | ||
((pos_lnum 1) | ||
(pos_bol 0) | ||
(pos_cnum 0))) | ||
(stop | ||
((pos_lnum 3) | ||
(pos_bol 28) | ||
(pos_cnum 43)))))) | ||
(entry | ||
((src | ||
(In_build_dir default/foo.cmxa)) | ||
(kind file) | ||
(dst foo.cmxa) | ||
(section LIB) | ||
(optional false)))) | ||
((source | ||
(User | ||
((pos_fname dune) | ||
(start | ||
((pos_lnum 1) | ||
(pos_bol 0) | ||
(pos_cnum 0))) | ||
(stop | ||
((pos_lnum 3) | ||
(pos_bol 28) | ||
(pos_cnum 43)))))) | ||
(entry | ||
((src | ||
(In_build_dir default/foo.ml)) | ||
(kind file) | ||
(dst foo.ml) | ||
(section LIB) | ||
(optional false)))) | ||
((source Dune) | ||
(entry | ||
((src | ||
(In_build_dir default/foo.opam)) | ||
(kind file) | ||
(dst opam) | ||
(section LIB) | ||
(optional false)))) | ||
((source | ||
(User | ||
((pos_fname dune) | ||
(start | ||
((pos_lnum 1) | ||
(pos_bol 0) | ||
(pos_cnum 0))) | ||
(stop | ||
((pos_lnum 3) | ||
(pos_bol 28) | ||
(pos_cnum 43)))))) | ||
(entry | ||
((src | ||
(In_build_dir default/foo.cmxs)) | ||
(kind file) | ||
(dst foo.cmxs) | ||
(section LIBEXEC) | ||
(optional false)))) | ||
((source | ||
(User | ||
((pos_fname dune) | ||
(start | ||
((pos_lnum 13) | ||
(pos_bol 144) | ||
(pos_cnum 152))) | ||
(stop | ||
((pos_lnum 13) | ||
(pos_bol 144) | ||
(pos_cnum 160)))))) | ||
(entry | ||
((src | ||
(In_build_dir default/main.exe)) | ||
(kind file) | ||
(dst main.exe) | ||
(section BIN) | ||
(optional false))))))) |