mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-08 07:51:43 +03:00
'catala depends': allow specifying multiple files
The return is a topological order over their joint dependencies. NOTE: the specified files are now included in the returns
This commit is contained in:
parent
dc6bfae75c
commit
9bf441ae31
@ -468,7 +468,7 @@ module Flags = struct
|
|||||||
let extra_files =
|
let extra_files =
|
||||||
value
|
value
|
||||||
& pos_right 0 file []
|
& pos_right 0 file []
|
||||||
& Arg.info [] ~docv:"FILE" ~docs:Manpage.s_arguments
|
& Arg.info [] ~docv:"FILES" ~docs:Manpage.s_arguments
|
||||||
~doc:"Additional input files."
|
~doc:"Additional input files."
|
||||||
|
|
||||||
let lcalc =
|
let lcalc =
|
||||||
|
@ -989,9 +989,26 @@ module Commands = struct
|
|||||||
$ Cli.Flags.optimize
|
$ Cli.Flags.optimize
|
||||||
$ Cli.Flags.check_invariants)
|
$ Cli.Flags.check_invariants)
|
||||||
|
|
||||||
let depends options includes prefix extension =
|
let depends options includes prefix extension extra_files =
|
||||||
let prg = Passes.surface options in
|
let prg =
|
||||||
let prg = { prg with program_items = [] } in
|
let file = Cli.input_src_file options.Cli.input_src in
|
||||||
|
Surface.Ast.
|
||||||
|
{
|
||||||
|
program_module_name = None;
|
||||||
|
program_items = [];
|
||||||
|
program_source_files = [];
|
||||||
|
program_used_modules =
|
||||||
|
List.map
|
||||||
|
(fun f ->
|
||||||
|
let name = modname_of_file f in
|
||||||
|
{
|
||||||
|
mod_use_name = name, Pos.no_pos;
|
||||||
|
mod_use_alias = name, Pos.no_pos;
|
||||||
|
})
|
||||||
|
(file :: extra_files);
|
||||||
|
program_lang = Cli.file_lang file;
|
||||||
|
}
|
||||||
|
in
|
||||||
let mod_uses, modules = load_module_interfaces options includes prg in
|
let mod_uses, modules = load_module_interfaces options includes prg in
|
||||||
let d_ctx =
|
let d_ctx =
|
||||||
Desugared.Name_resolution.form_context (prg, mod_uses) modules
|
Desugared.Name_resolution.form_context (prg, mod_uses) modules
|
||||||
@ -1026,17 +1043,19 @@ module Commands = struct
|
|||||||
Cmd.v
|
Cmd.v
|
||||||
(Cmd.info "depends"
|
(Cmd.info "depends"
|
||||||
~doc:
|
~doc:
|
||||||
"Lists the dependencies of a given catala file, in linking order. \
|
"Lists the dependencies of the given catala files, in linking \
|
||||||
This includes recursive dependencies and is useful for linking an \
|
order. This includes recursive dependencies and is useful for \
|
||||||
application in a target language. The space-separated list is \
|
linking an application in a target language. The space-separated \
|
||||||
printed to stdout. The names are printed as expected of module \
|
list is printed to stdout. The names are printed as expected of \
|
||||||
identifiers, $(i,i.e.) capitalized.")
|
module identifiers, $(i,i.e.) capitalized.\n\
|
||||||
|
NOTE: the files specified are also included in the returned list.")
|
||||||
Term.(
|
Term.(
|
||||||
const depends
|
const depends
|
||||||
$ Cli.Flags.Global.options
|
$ Cli.Flags.Global.options
|
||||||
$ Cli.Flags.include_dirs
|
$ Cli.Flags.include_dirs
|
||||||
$ Cli.Flags.prefix
|
$ Cli.Flags.prefix
|
||||||
$ Cli.Flags.extension)
|
$ Cli.Flags.extension
|
||||||
|
$ Cli.Flags.extra_files)
|
||||||
|
|
||||||
let pygmentize_cmd =
|
let pygmentize_cmd =
|
||||||
Cmd.v
|
Cmd.v
|
||||||
|
Loading…
Reference in New Issue
Block a user