Display an error when no installable mode is found
If an executable is only available as a shared object for example, Dune cannot install it. In that case, it displays an error message. However, it is still possible to build a private one explicitly. Signed-off-by: Etienne Millon <etienne@cryptosense.com>
This commit is contained in:
parent
79b8caf4d2
commit
9c2e4f14e0
|
@ -879,8 +879,16 @@ module Executables = struct
|
|||
; buildable
|
||||
}
|
||||
in
|
||||
let has_public_name =
|
||||
List.exists ~f:Option.is_some public_names
|
||||
in
|
||||
let to_install =
|
||||
match Link_mode.Set.best_install_mode t.modes with
|
||||
| None when has_public_name ->
|
||||
Loc.fail
|
||||
buildable.loc
|
||||
"No installable mode found for %s."
|
||||
(if multi then "these executables" else "this executable")
|
||||
| None -> []
|
||||
| Some mode ->
|
||||
let ext =
|
||||
|
|
|
@ -372,6 +372,15 @@
|
|||
(run ${exe:cram.exe} -skip-versions 4.02.3 -test run.t)
|
||||
(diff? run.t run.t.corrected))))))
|
||||
|
||||
(alias
|
||||
((name no-installable-mode)
|
||||
(deps
|
||||
((package dune) (files_recursively_in test-cases/no-installable-mode)))
|
||||
(action
|
||||
(chdir
|
||||
test-cases/no-installable-mode
|
||||
(progn (run ${exe:cram.exe} -test run.t) (diff? run.t run.t.corrected))))))
|
||||
|
||||
(alias
|
||||
((name null-dep)
|
||||
(deps ((package dune) (files_recursively_in test-cases/null-dep)))
|
||||
|
@ -579,6 +588,7 @@
|
|||
(alias meta-gen)
|
||||
(alias misc)
|
||||
(alias multiple-private-libs)
|
||||
(alias no-installable-mode)
|
||||
(alias null-dep)
|
||||
(alias ocaml-syntax)
|
||||
(alias ocamldep-multi-stanzas)
|
||||
|
@ -639,6 +649,7 @@
|
|||
(alias merlin-tests)
|
||||
(alias meta-gen)
|
||||
(alias misc)
|
||||
(alias no-installable-mode)
|
||||
(alias null-dep)
|
||||
(alias ocaml-syntax)
|
||||
(alias ocamldep-multi-stanzas)
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
(jbuild_version 1)
|
||||
|
||||
(executable
|
||||
(
|
||||
(name myprivatelib)
|
||||
(modes (shared_object))
|
||||
)
|
||||
)
|
|
@ -0,0 +1,9 @@
|
|||
(jbuild_version 1)
|
||||
|
||||
(executable
|
||||
(
|
||||
(name mylib)
|
||||
(public_name mylib)
|
||||
(modes (shared_object))
|
||||
)
|
||||
)
|
|
@ -0,0 +1,16 @@
|
|||
When a public executable is built in shared_object mode, a specific error
|
||||
message is displayed:
|
||||
|
||||
$ dune build --root=public --display=short
|
||||
File "jbuild", line 4, characters 2-74:
|
||||
Error: No installable mode found for this executable.
|
||||
[1]
|
||||
|
||||
However, it is possible to build a private one explicitly.
|
||||
|
||||
$ dune build --root=private --display=short myprivatelib.so
|
||||
Entering directory 'private'
|
||||
ocamldep myprivatelib.ml.d
|
||||
ocamlc .myprivatelib.eobjs/myprivatelib.{cmi,cmo,cmt}
|
||||
ocamlopt .myprivatelib.eobjs/myprivatelib.{cmx,o}
|
||||
ocamlopt myprivatelib$ext_dll
|
Loading…
Reference in New Issue