diff --git a/.travis-ci.sh b/.travis-ci.sh index ea2bf7ff..9b4f5290 100644 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -90,7 +90,7 @@ case "$TARGET" in echo -en "travis_fold:end:dune.bootstrap\r" ./boot.exe --subst echo -en "travis_fold:start:dune.boot\r" - ./boot.exe --dev + ./boot.exe echo -en "travis_fold:end:dune.boot\r" if [ $WITH_OPAM -eq 1 ] ; then _build/install/default/bin/dune runtest && \ diff --git a/Makefile b/Makefile index 29532df8..722497e5 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ INSTALL_ARGS := $(if $(PREFIX),--prefix $(PREFIX),) -BIN := ./_build/default/bin/main.exe +BIN := ./_build/default/bin/main_dune.exe -include Makefile.dev diff --git a/bin/dune b/bin/dune index ace54afa..3ad1738a 100644 --- a/bin/dune +++ b/bin/dune @@ -1,11 +1,20 @@ +(library + (name main) + (modules (main)) + (libraries unix dune cmdliner)) + (executable - (name main) + (name main_dune) (public_name dune) (package dune) - (libraries unix dune cmdliner) + (modules (main_dune)) + (libraries which_program_dune main) (preprocess no_preprocessing)) -(install - (section bin) - (package dune) - (files (main.exe as jbuilder))) +(executable + (name main_jbuilder) + (public_name jbuilder) + (package dune) + (modules (main_jbuilder)) + (libraries which_program_jbuilder main) + (preprocess no_preprocessing)) diff --git a/bin/main.ml b/bin/main.ml index d51cd98f..6ffdfdd9 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -1538,7 +1538,7 @@ let default = ] ) -let () = +let main () = Colors.setup_err_formatter_colors (); try match Term.eval_choice default all ~catch:false with diff --git a/bin/main.mli b/bin/main.mli index e790aeb7..86f37aa4 100644 --- a/bin/main.mli +++ b/bin/main.mli @@ -1 +1 @@ -(* empty *) +val main : unit -> unit diff --git a/bin/main_dune.ml b/bin/main_dune.ml new file mode 100644 index 00000000..6c61511f --- /dev/null +++ b/bin/main_dune.ml @@ -0,0 +1 @@ +let () = Main.main () diff --git a/bin/main_dune.mli b/bin/main_dune.mli new file mode 100644 index 00000000..e790aeb7 --- /dev/null +++ b/bin/main_dune.mli @@ -0,0 +1 @@ +(* empty *) diff --git a/bin/main_jbuilder.ml b/bin/main_jbuilder.ml new file mode 100644 index 00000000..6c61511f --- /dev/null +++ b/bin/main_jbuilder.ml @@ -0,0 +1 @@ +let () = Main.main () diff --git a/bin/main_jbuilder.mli b/bin/main_jbuilder.mli new file mode 100644 index 00000000..e790aeb7 --- /dev/null +++ b/bin/main_jbuilder.mli @@ -0,0 +1 @@ +(* empty *) diff --git a/bootstrap.ml b/bootstrap.ml index c0513ecb..6d79fd25 100644 --- a/bootstrap.ml +++ b/bootstrap.ml @@ -29,7 +29,8 @@ end (* Directories with library names *) let dirs = - [ "src/stdune/caml" , Some "Caml" + [ "src/which_program" , Some "Which_program" + ; "src/stdune/caml" , Some "Caml" ; "src/stdune" , Some "Stdune" ; "src/fiber" , Some "Fiber" ; "src/xdg" , Some "Xdg" diff --git a/src/which_program/dune b/src/which_program/dune new file mode 100644 index 00000000..75f96c61 --- /dev/null +++ b/src/which_program/dune @@ -0,0 +1,14 @@ +(library + (name which_program) + (public_name dune.which-program) + (synopsis "[Internal] Standard library of Dune") + (wrapped false) + (flags (:standard (:include no-keep-locs))) + (modules_without_implementation which_program)) + +; To avoid issues on Windows and OSX +(rule (with-stdout-to which_program_dummy.ml (echo ""))) + +(rule + (with-stdout-to no-keep-locs + (run %{OCAML} %{path:gen-no-keep-locs} %{ocaml_version}))) diff --git a/src/which_program/dune-impl/dune b/src/which_program/dune-impl/dune new file mode 100644 index 00000000..6507c17d --- /dev/null +++ b/src/which_program/dune-impl/dune @@ -0,0 +1,7 @@ +(library + (name which_program_dune) + (public_name dune.which-program.dune) + (wrapped false) + (flags (:standard (:include ../no-keep-locs)))) + +(rule (copy# ../which_program.mli which_program.mli)) diff --git a/src/which_program/dune-impl/which_program.ml b/src/which_program/dune-impl/which_program.ml new file mode 100644 index 00000000..4552078b --- /dev/null +++ b/src/which_program/dune-impl/which_program.ml @@ -0,0 +1,2 @@ +type t = Dune | Jbuilder +let t = Dune diff --git a/src/which_program/gen-no-keep-locs b/src/which_program/gen-no-keep-locs new file mode 100644 index 00000000..99efc278 --- /dev/null +++ b/src/which_program/gen-no-keep-locs @@ -0,0 +1,8 @@ +(* -*- tuared -*- *) + +let () = + let ver = Scanf.sscanf Sys.argv.(1) "%u.%u" (fun a b -> a, b) in + if ver >= (4, 03) then + print_endline "(-no-keep-locs)" + else + print_endline "()" diff --git a/src/which_program/jbuilder-impl/dune b/src/which_program/jbuilder-impl/dune new file mode 100644 index 00000000..4e424233 --- /dev/null +++ b/src/which_program/jbuilder-impl/dune @@ -0,0 +1,7 @@ +(library + (name which_program_jbuilder) + (public_name dune.which-program.jbuilder) + (wrapped false) + (flags (:standard (:include ../no-keep-locs)))) + +(rule (copy# ../which_program.mli which_program.mli)) diff --git a/src/which_program/jbuilder-impl/which_program.ml b/src/which_program/jbuilder-impl/which_program.ml new file mode 100644 index 00000000..6395e83d --- /dev/null +++ b/src/which_program/jbuilder-impl/which_program.ml @@ -0,0 +1,2 @@ +type t = Dune | Jbuilder +let t = Jbuilder diff --git a/src/which_program/which_program.boot.ml b/src/which_program/which_program.boot.ml new file mode 100644 index 00000000..4552078b --- /dev/null +++ b/src/which_program/which_program.boot.ml @@ -0,0 +1,2 @@ +type t = Dune | Jbuilder +let t = Dune diff --git a/src/which_program/which_program.mli b/src/which_program/which_program.mli new file mode 100644 index 00000000..50d7c735 --- /dev/null +++ b/src/which_program/which_program.mli @@ -0,0 +1,5 @@ +(** Whether we are 'dune' or 'jbuilder' *) + +type t = Dune | Jbuilder + +val t : t diff --git a/test/blackbox-tests/test-cases/output-obj/run.t b/test/blackbox-tests/test-cases/output-obj/run.t index 0654385a..dbcdbcd1 100644 --- a/test/blackbox-tests/test-cases/output-obj/run.t +++ b/test/blackbox-tests/test-cases/output-obj/run.t @@ -12,11 +12,11 @@ ocamlopt test$ext_dll $ dune build @runtest + dynamic alias runtest + OK: ./dynamic.exe ./test$ext_dll static alias runtest OK: ./static.bc - dynamic alias runtest - OK: ./dynamic.exe ./test.bc.so static alias runtest OK: ./static.exe dynamic alias runtest - OK: ./dynamic.exe ./test$ext_dll + OK: ./dynamic.exe ./test.bc.so