Skip to content

Commit

Permalink
Let program version be set from Private_common
Browse files Browse the repository at this point in the history
* Fix for "dev" version in diskuv/dkml-installer-ocaml#1
  • Loading branch information
Jonah Beckford committed Sep 4, 2022
1 parent eb9f3fb commit d229475
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 43 deletions.
1 change: 0 additions & 1 deletion dkml-install-installer.opam
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ depends: [
"dkml-install" {= version}
"dkml-install-runner" {= version}
"dune" {>= "2.9"}
"dune-build-info"
"astring" {>= "0.8.5"}
"bos" {>= "0.2.0"}
"cmdliner" {>= "1.0.4"}
Expand Down
15 changes: 4 additions & 11 deletions installer/dune-generator/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ let main () project_root corrected =
@ [ Atom ":include"; Atom "user-link-flags.sexp" ]);
];
libraries
([ "dkml-install-runner.user"; "dune-build-info" ]
([ "dkml-install-runner.user"; "private_common" ]
@ dkml_components);
];
executable
Expand All @@ -98,7 +98,7 @@ let main () project_root corrected =
@ [ Atom ":include"; Atom "admin-link-flags.sexp" ]);
];
libraries
([ "dkml-install-runner.admin"; "dune-build-info" ]
([ "dkml-install-runner.admin"; "private_common" ]
@ dkml_components);
];
executable
Expand Down Expand Up @@ -143,8 +143,7 @@ let main () project_root corrected =
executable
[
name "entry_assembly_manifest";
libraries
[ "dkml-package-console.common"; "dune-build-info"; "fmt" ];
libraries [ "dkml-package-console.common"; "private_common"; "fmt" ];
modules [ "entry_assembly_manifest" ];
];
rule
Expand All @@ -161,12 +160,7 @@ let main () project_root corrected =
name "package_setup";
modes_byte_exe;
libraries
([
"dkml-package-console.setup";
"dune-build-info";
"cmdliner";
"private_common";
]
([ "dkml-package-console.setup"; "cmdliner"; "private_common" ]
@ dkml_components);
modules [ "package_setup" ];
];
Expand All @@ -177,7 +171,6 @@ let main () project_root corrected =
libraries
([
"dkml-package-console.uninstaller";
"dune-build-info";
"cmdliner";
"private_common";
]
Expand Down
1 change: 0 additions & 1 deletion installer/ml-generator/code/dune
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
(name private_ignored_code)
(libraries
cmdliner
dune-build-info
dkml-package-console.create
dkml-package-console.entry
dkml-package-console.setup
Expand Down
5 changes: 1 addition & 4 deletions installer/ml-generator/code/entry_assembly_manifest.ml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
let () =
let version_m_n_o_p =
Dkml_package_console_common.version_m_n_o_p
(match Build_info.V1.version () with
| None -> (* default m.n.o.p *) ""
| Some v -> Build_info.V1.Version.to_string v)
Dkml_package_console_common.version_m_n_o_p Private_common.program_version
in
print_endline
(Fmt.str
Expand Down
10 changes: 3 additions & 7 deletions installer/ml-generator/code/package_setup.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@ module Term = Cmdliner.Term
(* TEMPLATE: register () *)

let setup_cmd =
let program_version =
match Build_info.V1.version () with
| None -> "dev"
| Some v -> Build_info.V1.Version.to_string v
in
let doc = "the DKML OCaml installer" in
( Term.(
const setup
$ const (failwith "TEMPLATE: target_abi")
$ const program_version
$ const Private_common.program_version
$ const Private_common.organization
$ const Private_common.program_name
$ const Private_common.program_assets
Expand All @@ -23,7 +18,8 @@ let setup_cmd =
~target_abi:(failwith "TEMPLATE: target_abi")
~install_direction:
Dkml_install_runner.Path_eval.Global_context.Install),
Term.info "dkml-package-setup" ~version:program_version ~doc )
Term.info "dkml-package-setup" ~version:Private_common.program_version ~doc
)

let () =
Term.(
Expand Down
8 changes: 2 additions & 6 deletions installer/ml-generator/code/package_uninstaller.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ module Term = Cmdliner.Term
(* TEMPLATE: register () *)

let uninstall_cmd =
let program_version =
match Build_info.V1.version () with
| None -> "dev"
| Some v -> Build_info.V1.Version.to_string v
in
let doc = "the DKML OCaml uninstaller" in
( Term.(
const uninstall
Expand All @@ -19,7 +14,8 @@ let uninstall_cmd =
~target_abi:(failwith "TEMPLATE: target_abi")
~install_direction:
Dkml_install_runner.Path_eval.Global_context.Uninstall),
Term.info "dkml-package-uninstaller" ~version:program_version ~doc )
Term.info "dkml-package-uninstaller" ~version:Private_common.program_version
~doc )

let () =
Term.(
Expand Down
2 changes: 2 additions & 0 deletions installer/ml-generator/code/private_common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ let program_name =
installation_prefix_kebab_lower_case_opt = None;
}

let program_version = "0.0.0-dev"

let program_assets = { Author_types.logo_icon_32x32_opt = None }

let program_info =
Expand Down
7 changes: 1 addition & 6 deletions installer/ml-generator/code/runner_admin.ml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
(* TEMPLATE: register () *)

let () =
let program_version =
match Build_info.V1.version () with
| None -> "dev"
| Some v -> Build_info.V1.Version.to_string v
in
Dkml_install_runner_admin.main
~target_abi:(failwith "TEMPLATE: target_abi")
~program_version
~program_version:Private_common.program_version
7 changes: 1 addition & 6 deletions installer/ml-generator/code/runner_user.ml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
(* TEMPLATE: register () *)

let () =
let program_version =
match Build_info.V1.version () with
| None -> "dev"
| Some v -> Build_info.V1.Version.to_string v
in
Dkml_install_runner_user.main
~target_abi:(failwith "TEMPLATE: target_abi")
~program_version
~program_version:Private_common.program_version
3 changes: 2 additions & 1 deletion package/console/common/dkml_package_console_common.mli
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ Confer https://docs.microsoft.com/en-us/windows/win32/sbscs/application-manifest

(** {1 Running Programs} *)

val spawn : ?err_ok:bool -> Bos.Cmd.t -> unit Dkml_install_api.Forward_progress.t
val spawn :
?err_ok:bool -> Bos.Cmd.t -> unit Dkml_install_api.Forward_progress.t
(** [spawn ?err_ok cmd] launches the command [cmd] and waits for its response.
Use [err_ok = true] if you want to log errors but continue. *)
Expand Down

0 comments on commit d229475

Please sign in to comment.