Add a -p/--for-release-of-packages command line argument
`-p pkgs` is the equivalent of `--root . --only-packages pkgs`
This commit is contained in:
parent
eb68c98f01
commit
72550dc3e0
40
bin/main.ml
40
bin/main.ml
|
@ -110,7 +110,6 @@ let help_secs =
|
|||
let common =
|
||||
let make
|
||||
concurrency
|
||||
only_packages
|
||||
debug_rules
|
||||
debug_actions
|
||||
debug_dep_path
|
||||
|
@ -118,7 +117,7 @@ let common =
|
|||
dev_mode
|
||||
verbose
|
||||
workspace_file
|
||||
root
|
||||
(root, only_packages)
|
||||
=
|
||||
let root, to_cwd =
|
||||
match root with
|
||||
|
@ -209,13 +208,42 @@ let common =
|
|||
& opt (some dir) None
|
||||
& info ["root"] ~docs ~docv:"DIR"
|
||||
~doc:{|Use this directory as workspace root instead of guessing it.
|
||||
Note that this option doesn't change the interpretation of
|
||||
targets given on the command line. It is only intended
|
||||
Note that this option doesn't change the interpretation of
|
||||
targets given on the command line. It is only intended
|
||||
for scripts.|})
|
||||
in
|
||||
let for_release = "for-release-of-packages" in
|
||||
let frop =
|
||||
Arg.(value
|
||||
& opt (some string) None
|
||||
& info ["p"; for_release] ~docs ~docv:"PACKAGES"
|
||||
~doc:{|Shorthand for $(b,--root . --only-packages PACKAGE).|})
|
||||
in
|
||||
let root_and_only_packages =
|
||||
let merge root only_packages release =
|
||||
match release, root, only_packages with
|
||||
| Some _, Some _, _ ->
|
||||
`Error (true,
|
||||
sprintf
|
||||
"Cannot use %s and --root simultaneously"
|
||||
for_release)
|
||||
| Some _, _, Some _ ->
|
||||
`Error (true,
|
||||
sprintf
|
||||
"Cannot use %s and --only-packages simultaneously"
|
||||
for_release)
|
||||
| Some pkgs, None, None ->
|
||||
`Ok (Some ".", Some pkgs)
|
||||
| None, _, _ ->
|
||||
`Ok (root, only_packages)
|
||||
in
|
||||
Term.(ret (const merge
|
||||
$ root
|
||||
$ only_packages
|
||||
$ frop))
|
||||
in
|
||||
Term.(const make
|
||||
$ concurrency
|
||||
$ only_packages
|
||||
$ drules
|
||||
$ dactions
|
||||
$ ddep_path
|
||||
|
@ -223,7 +251,7 @@ let common =
|
|||
$ dev
|
||||
$ verbose
|
||||
$ workspace_file
|
||||
$ root
|
||||
$ root_and_only_packages
|
||||
)
|
||||
|
||||
let installed_libraries =
|
||||
|
|
|
@ -1178,9 +1178,12 @@ You should set the =build:= field of your =<package>.opam= file as
|
|||
follows:
|
||||
|
||||
#+begin_src
|
||||
build: [["jbuilder" "build" "--only-packages" "<package>" "--root" "." "-j" jobs "@install"]]
|
||||
build: [["jbuilder" "build" "-p" "<package>" "-j" jobs]]
|
||||
#+end_src
|
||||
|
||||
=-p pkg= is a shorthand for =--root . --only-packages pkg=. =-p= is
|
||||
the short version of =--for-release-of-packages=.
|
||||
|
||||
This has the following effects:
|
||||
- it tells jbuilder to build everything that is installable and to
|
||||
ignore packages other than =<package>= defined in your project
|
||||
|
|
|
@ -24,7 +24,7 @@ let setup ?(log=Log.no_log) ?filter_out_optional_stanzas_with_missing_deps
|
|||
String_set.iter set ~f:(fun pkg ->
|
||||
if not (String_map.mem pkg conf.packages) then
|
||||
die "@{<error>Error@}: I don't know about package %s \
|
||||
(passed through --only-packages)%s"
|
||||
(passed through --only-packages/--release)%s"
|
||||
pkg (hint pkg (String_map.keys conf.packages))));
|
||||
let workspace =
|
||||
match workspace with
|
||||
|
|
Loading…
Reference in New Issue