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

Use dune-build-info to manage version information #1783

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

3 changes: 1 addition & 2 deletions compiler/bin-js_of_ocaml/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
(package js_of_ocaml-compiler)
(libraries
jsoo_cmdline
js_of_ocaml-compiler
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

js_of_ocaml-compiler is a (direct) dependency

cmdliner
compiler-libs.common
js_of_ocaml-compiler.runtime-files
js_of_ocaml-compiler.version
(select
findlib_support.ml
from
Expand Down
7 changes: 1 addition & 6 deletions compiler/bin-js_of_ocaml/info.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)

open Js_of_ocaml_compiler
open Cmdliner

let make ~name ~doc ~description =
Expand All @@ -41,9 +40,5 @@ let make ~name ~doc ~description =
or (at your option) any later version."
]
in
let version =
match Compiler_version.git_version with
| "" -> Compiler_version.s
| v -> Printf.sprintf "%s+%s" Compiler_version.s v
in
let version = Jsoo_version.get () in
Cmd.info name ~version ~doc ~man
7 changes: 1 addition & 6 deletions compiler/bin-jsoo_minify/cmd_arg.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*)

open! Js_of_ocaml_compiler.Stdlib
open Js_of_ocaml_compiler
open Cmdliner

type t =
Expand Down Expand Up @@ -69,9 +68,5 @@ let info =
or (at your option) any later version."
]
in
let version =
match Compiler_version.git_version with
| "" -> Compiler_version.s
| v -> Printf.sprintf "%s+%s" Compiler_version.s v
in
let version = Jsoo_version.get () in
Cmd.info "jsoo_minify" ~version ~doc ~man
2 changes: 1 addition & 1 deletion compiler/bin-jsoo_minify/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(name jsoo_minify)
(public_name jsoo_minify)
(package js_of_ocaml-compiler)
(libraries jsoo_cmdline js_of_ocaml-compiler cmdliner compiler-libs.common)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

js_of_ocaml-compiler is a direct dependency

(libraries jsoo_cmdline cmdliner js_of_ocaml-compiler.version)
(flags
(:standard -safe-string)))

Expand Down
2 changes: 1 addition & 1 deletion compiler/bin-wasm_of_ocaml/dune
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
jsoo_cmdline
wasm_of_ocaml-compiler
cmdliner
compiler-libs.common
js_of_ocaml-compiler.runtime-files
js_of_ocaml-compiler.version
yojson
(select
findlib_support.ml
Expand Down
7 changes: 1 addition & 6 deletions compiler/bin-wasm_of_ocaml/info.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)

open Js_of_ocaml_compiler
open Cmdliner

let make ~name ~doc ~description =
Expand All @@ -40,9 +39,5 @@ let make ~name ~doc ~description =
or (at your option) any later version."
]
in
let version =
match Compiler_version.git_version with
| "" -> Compiler_version.s
| v -> Printf.sprintf "%s+git-%s" Compiler_version.s v
in
let version = Jsoo_version.get () in
Cmd.info name ~version ~doc ~man
6 changes: 1 addition & 5 deletions compiler/lib/build_info.ml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,7 @@ let kind t =
| s -> kind_of_string s

let create kind =
let version =
match Compiler_version.git_version with
| "" -> Compiler_version.s
| v -> Printf.sprintf "%s+%s" Compiler_version.s v
in
let version = Jsoo_version.get () in
[ "use-js-string", string_of_bool (Config.Flag.use_js_string ())
; "effects", string_of_effects_backend (Config.effects ())
; "version", version
Expand Down
23 changes: 0 additions & 23 deletions compiler/lib/compiler_version.mli

This file was deleted.

10 changes: 2 additions & 8 deletions compiler/lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
(public_name js_of_ocaml-compiler)
(synopsis "Js_of_ocaml compiler library")
(libraries
compiler-libs.common
compiler-libs.bytecomp
compiler-libs.common
js_of_ocaml-compiler.version
menhirLib
sedlex
yojson)
Expand Down Expand Up @@ -34,10 +35,3 @@

(menhir
(modules annot_parser))

(rule
(targets compiler_version.ml)
(deps
(:input-file ../../version.ml.in))
(action
(copy %{input-file} %{targets})))
10 changes: 0 additions & 10 deletions dune
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@
(tools/node_wrapper.exe as node)
(tools/node_wrapper.exe as node.exe))))

(rule
(targets version.ml.in)
(action
(with-stdout-to
%{targets}
(run
%{dep:tools/version/gen/gen.exe}
%{dep:VERSION}
%{dep:tools/version/GIT-VERSION}))))

(data_only_dirs _wikidoc doc-dev janestreet)

(vendored_dirs)
1 change: 1 addition & 0 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js")
(depends
(ocaml (and (>= 4.08) (< 5.4)))
dune-build-info
(num :with-test)
(ppx_expect (and (>= v0.16.1) :with-test))
(ppxlib (>= 0.15.0))
Expand Down
1 change: 1 addition & 0 deletions js_of_ocaml-compiler.opam
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ bug-reports: "https://github.com/ocsigen/js_of_ocaml/issues"
depends: [
"dune" {>= "3.17"}
"ocaml" {>= "4.08" & < "5.4"}
"dune-build-info"
"num" {with-test}
"ppx_expect" {>= "v0.16.1" & with-test}
"ppxlib" {>= "0.15.0"}
Expand Down
9 changes: 1 addition & 8 deletions lib/js_of_ocaml/dune
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(library
(name js_of_ocaml)
(public_name js_of_ocaml)
(libraries js_of_ocaml-compiler.runtime)
(libraries js_of_ocaml-compiler.runtime js_of_ocaml-compiler.version)
(foreign_stubs
(language c)
(names js_of_ocaml_stubs))
Expand All @@ -20,10 +20,3 @@
(with-stdout-to
%{targets}
(run ../gen_stubs/gen_stubs.exe %{jsoo} --except %{runtime}))))

(rule
(targets lib_version.ml)
(deps
(:input-file ../../version.ml.in))
(action
(copy %{input-file} %{targets})))
5 changes: 1 addition & 4 deletions lib/js_of_ocaml/sys_js.ml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,4 @@ let mount ~path f =

let unmount ~path = unmount path

let js_of_ocaml_version =
if String.equal Lib_version.git_version ""
then Lib_version.s
else Lib_version.s ^ "+" ^ Lib_version.git_version
let js_of_ocaml_version = Jsoo_version.get ()
12 changes: 3 additions & 9 deletions lib/runtime/dune
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
(library
(name jsoo_runtime)
(public_name js_of_ocaml-compiler.runtime)
(libraries js_of_ocaml-compiler.version)
(foreign_stubs
(language c)
(names js_of_ocaml_runtime_stubs))
(public_name js_of_ocaml-compiler.runtime))
(names js_of_ocaml_runtime_stubs)))

(rule
(targets js_of_ocaml_runtime_stubs.c)
Expand All @@ -14,10 +15,3 @@
(with-stdout-to
%{targets}
(run ../gen_stubs/gen_stubs.exe %{deps}))))

(rule
(targets runtime_version.ml)
(deps
(:input-file ../../version.ml.in))
(action
(copy %{input-file} %{targets})))
4 changes: 1 addition & 3 deletions lib/runtime/jsoo_runtime.ml
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ module Sys = struct
| _ -> assert false
end

let version = Runtime_version.s

let git_version = Runtime_version.git_version
let version = Jsoo_version.get ()
end

module Error : sig
Expand Down
4 changes: 4 additions & 0 deletions lib/version/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(library
(name jsoo_version)
(public_name js_of_ocaml-compiler.version)
(libraries dune-build-info))
4 changes: 4 additions & 0 deletions lib/version/jsoo_version.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
let get () =
match Build_info.V1.version () with
| None -> "dev"
| Some v -> Build_info.V1.Version.to_string v
24 changes: 0 additions & 24 deletions tools/version/dune

This file was deleted.

3 changes: 0 additions & 3 deletions tools/version/gen/dune

This file was deleted.

37 changes: 0 additions & 37 deletions tools/version/gen/gen.ml

This file was deleted.

Loading