Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site n build info #1643

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions compiler/tests-build-info/dune
Original file line number Diff line number Diff line change
@@ -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))
6 changes: 6 additions & 0 deletions compiler/tests-build-info/dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(lang dune 3.17)
(using dune_site 0.1)

(package
(name js_of_ocaml-tests)
(sites (share tests)))
17 changes: 17 additions & 0 deletions compiler/tests-build-info/main.ml
Original file line number Diff line number Diff line change
@@ -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
Loading