diff --git a/compiler/tests-build-info/dune b/compiler/tests-build-info/dune new file mode 100644 index 0000000000..b95193569e --- /dev/null +++ b/compiler/tests-build-info/dune @@ -0,0 +1,23 @@ +(env + (_ + (js_of_ocaml + (compilation_mode separate)))) + +(executable + (name main) + (modes js wasm byte native) + (modules main mysites) + (libraries dune-build-info dune-site)) + +(generate_sites_module + (module mysites) + (sites js_of_ocaml-tests)) + +(install + (section libexec) + (package js_of_ocaml-tests) + (files + (main.bc.js as test-build-info.bc.js) + (main.exe as test-build-info.exe) + (main.bc.wasm.js as test-build-info.bc.wasm.js)) + (dirs main.bc.wasm.assets)) diff --git a/compiler/tests-build-info/dune-project b/compiler/tests-build-info/dune-project new file mode 100644 index 0000000000..1a68aab6d7 --- /dev/null +++ b/compiler/tests-build-info/dune-project @@ -0,0 +1,6 @@ +(lang dune 3.17) +(using dune_site 0.1) + +(package + (name js_of_ocaml-tests) + (sites (share tests))) \ No newline at end of file diff --git a/compiler/tests-build-info/main.ml b/compiler/tests-build-info/main.ml new file mode 100644 index 0000000000..c86de800b1 --- /dev/null +++ b/compiler/tests-build-info/main.ml @@ -0,0 +1,17 @@ +let version = + match Build_info.V1.version () with + | None -> "unknown" + | Some v -> Build_info.V1.Version.to_string v + +let () = + print_endline "Version:"; + match String.split_on_char '-' version with + | [ tag; plus; _commit; dirty ] -> + Printf.printf "%s-%s-%s-%s\n%!" tag plus "xxxxx" dirty + | [ tag; plus; _commit ] -> Printf.printf "%s-%s-%s\n%!" tag plus "xxxxx" + | [ x ] -> print_endline x + | _ -> Printf.printf "unexpected: %s\n%!" version + +let () = + print_endline "Sites:"; + List.iter print_endline Mysites.Sites.tests