diff --git a/src/configurator/jbuild b/src/configurator/jbuild index 2b696467..2b11a82f 100644 --- a/src/configurator/jbuild +++ b/src/configurator/jbuild @@ -1,5 +1,6 @@ (library ((name configurator) + (public_name jbuilder.configurator) (libraries (stdune ocaml_config)) (flags (:standard -safe-string (:include flags/flags.sexp))) (preprocess no_preprocessing))) diff --git a/src/ocaml-config/jbuild b/src/ocaml-config/jbuild index df51c131..3fa057e4 100644 --- a/src/ocaml-config/jbuild +++ b/src/ocaml-config/jbuild @@ -2,5 +2,6 @@ (library ((name ocaml_config) + (public_name jbuilder.ocaml_config) (libraries (stdune usexp)) - (synopsis "Interpret the output of 'ocamlc -config'"))) + (synopsis "[Internal] Interpret the output of 'ocamlc -config'"))) diff --git a/src/ocaml-config/ocaml_config.mli b/src/ocaml-config/ocaml_config.mli index 793377e5..fbdbb92b 100644 --- a/src/ocaml-config/ocaml_config.mli +++ b/src/ocaml-config/ocaml_config.mli @@ -1,4 +1,6 @@ -(** Represent the output of [ocamlc -config] *) +(** Represent the output of [ocamlc -config]. + + This library is internal to jbuilder and guarantees no API stability. *) open Stdune diff --git a/src/stdune/caml/caml.ml b/src/stdune/caml/caml.ml index 82dc6ca9..a43c1037 100644 --- a/src/stdune/caml/caml.ml +++ b/src/stdune/caml/caml.ml @@ -1,3 +1,5 @@ +(** This library is internal to jbuilder and guarantees no API stability. *) + module Filename = Filename module String = String module Char = Char diff --git a/src/stdune/caml/jbuild b/src/stdune/caml/jbuild index 1886d286..04b16834 100644 --- a/src/stdune/caml/jbuild +++ b/src/stdune/caml/jbuild @@ -1,3 +1,4 @@ (library ((name caml) - (synopsis "Wrapped version of the OCaml stdlib"))) + (public_name jbuilder.caml) + (synopsis "[Internal] Wrapped version of the OCaml stdlib"))) diff --git a/src/stdune/jbuild b/src/stdune/jbuild index 36e4eaa0..b1f82de0 100644 --- a/src/stdune/jbuild +++ b/src/stdune/jbuild @@ -1,4 +1,5 @@ (library ((name stdune) - (synopsis "Standard library of Dune") + (public_name jbuilder.stdune) + (synopsis "[Internal] Standard library of Dune") (libraries (caml unix)))) diff --git a/src/usexp/jbuild b/src/usexp/jbuild index 2c10cbe2..53b46ee9 100644 --- a/src/usexp/jbuild +++ b/src/usexp/jbuild @@ -1,6 +1,9 @@ (jbuild_version 1) -(library ((name usexp))) +(library + ((name usexp) + (synopsis "[Internal] S-expression library") + (public_name jbuilder.usexp))) (rule (with-stdout-to table.ml.gen (run gen/gen_parser_automaton.exe))) diff --git a/src/usexp/usexp.mli b/src/usexp/usexp.mli index 5fa3a242..27e03dc7 100644 --- a/src/usexp/usexp.mli +++ b/src/usexp/usexp.mli @@ -1,4 +1,6 @@ -(** Parsing of s-expressions *) +(** Parsing of s-expressions. + + This library is internal to jbuilder and guarantees no API stability.*) module Atom : sig type t = private A of string [@@unboxed] diff --git a/test/blackbox-tests/jbuild b/test/blackbox-tests/jbuild index 01edbb92..becfd2ea 100644 --- a/test/blackbox-tests/jbuild +++ b/test/blackbox-tests/jbuild @@ -459,3 +459,13 @@ (progn (run ${exe:cram.exe} run.t) (diff? run.t run.t.corrected)))))) + +(alias + ((name runtest) + (deps ((package jbuilder) + (files_recursively_in test-cases/configurator))) + (action + (chdir test-cases/configurator + (progn + (run ${exe:cram.exe} run.t) + (diff? run.t run.t.corrected)))))) diff --git a/test/blackbox-tests/test-cases/configurator/c_test/jbuild b/test/blackbox-tests/test-cases/configurator/c_test/jbuild new file mode 100644 index 00000000..0f63b54a --- /dev/null +++ b/test/blackbox-tests/test-cases/configurator/c_test/jbuild @@ -0,0 +1,5 @@ +(jbuild_version 1) + +(executable + ((name run) + (libraries (jbuilder.configurator)))) diff --git a/test/blackbox-tests/test-cases/configurator/c_test/run.ml b/test/blackbox-tests/test-cases/configurator/c_test/run.ml new file mode 100644 index 00000000..dc3a9f08 --- /dev/null +++ b/test/blackbox-tests/test-cases/configurator/c_test/run.ml @@ -0,0 +1,15 @@ + +let () = + Configurator.main ~name:"c_test" (fun t -> + let c_result = + Configurator.c_test t {c| +#include +int main() +{ + printf("Hello, World!"); + return 0; +} +|c} in + assert c_result; + print_endline "Successfully compiled c program" + ) diff --git a/test/blackbox-tests/test-cases/configurator/config/jbuild b/test/blackbox-tests/test-cases/configurator/config/jbuild new file mode 100644 index 00000000..0f63b54a --- /dev/null +++ b/test/blackbox-tests/test-cases/configurator/config/jbuild @@ -0,0 +1,5 @@ +(jbuild_version 1) + +(executable + ((name run) + (libraries (jbuilder.configurator)))) diff --git a/test/blackbox-tests/test-cases/configurator/config/run.ml b/test/blackbox-tests/test-cases/configurator/config/run.ml new file mode 100644 index 00000000..e7e39784 --- /dev/null +++ b/test/blackbox-tests/test-cases/configurator/config/run.ml @@ -0,0 +1,6 @@ +let () = + Configurator.main ~name:"config" (fun t -> + match Configurator.ocaml_config_var t "version" with + | None -> failwith "version is absent" + | Some _ -> print_endline "version is present" + ) diff --git a/test/blackbox-tests/test-cases/configurator/import-define/jbuild b/test/blackbox-tests/test-cases/configurator/import-define/jbuild new file mode 100644 index 00000000..0f63b54a --- /dev/null +++ b/test/blackbox-tests/test-cases/configurator/import-define/jbuild @@ -0,0 +1,5 @@ +(jbuild_version 1) + +(executable + ((name run) + (libraries (jbuilder.configurator)))) diff --git a/test/blackbox-tests/test-cases/configurator/import-define/run.ml b/test/blackbox-tests/test-cases/configurator/import-define/run.ml new file mode 100644 index 00000000..42a9ab20 --- /dev/null +++ b/test/blackbox-tests/test-cases/configurator/import-define/run.ml @@ -0,0 +1,15 @@ +let () = + let module C_define = Configurator.C_define in + Configurator.main ~name:"c_test" (fun t -> + assert ( + C_define.import t + ~includes:["caml/config.h"] + [ "CAML_CONFIG_H", C_define.Type.Switch + ; "Page_log", C_define.Type.Int + ] = + [ "CAML_CONFIG_H", C_define.Value.Switch true + ; "Page_log", Int 12 + ] + ); + print_endline "Successfully import #define's" + ) diff --git a/test/blackbox-tests/test-cases/configurator/run.t b/test/blackbox-tests/test-cases/configurator/run.t new file mode 100644 index 00000000..9fbda06e --- /dev/null +++ b/test/blackbox-tests/test-cases/configurator/run.t @@ -0,0 +1,11 @@ +Show that config values are present + $ jbuilder exec config/run.exe + version is present + +We're able to compile C program sucessfully + $ jbuilder exec c_test/run.exe + Successfully compiled c program + +Importing #define's from code is successful + $ jbuilder exec import-define/run.exe + Successfully import #define's