Skip to content
Closed
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
18 changes: 9 additions & 9 deletions .drom
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ version:0.9.0

# hash of toml configuration files
# used for generation of all files
cfa41e62814087cf2f340eab496a6542:.
180286e3c80db6fd91f3a97d3292b49a:.
# end context for .

# begin context for .github/workflows/workflow.yml
Expand Down Expand Up @@ -40,7 +40,7 @@ cfa41e62814087cf2f340eab496a6542:.

# begin context for LICENSE.md
# file LICENSE.md
8fc45323c2500fb66e52deb392dda4f2:LICENSE.md
cf4da9c43c0026cec0ba46b9cfe8407e:LICENSE.md
# end context for LICENSE.md

# begin context for Makefile
Expand Down Expand Up @@ -100,7 +100,7 @@ e850a13c004f963e9f5a568eac93c217:dune

# begin context for dune-project
# file dune-project
47416b4e7b7e7febc8da32932cae0d54:dune-project
41a9f2fb18a3e715194c273faf222692:dune-project
# end context for dune-project

# begin context for opam/drom.opam
Expand All @@ -110,7 +110,7 @@ d3c8882f1742f865c2987dea6c7c83e2:opam/drom.opam

# begin context for opam/drom_lib.opam
# file opam/drom_lib.opam
8b323689fcc28f9783fa85ca4a4fac55:opam/drom_lib.opam
d64459c606b82fee0853f325bd899b7a:opam/drom_lib.opam
# end context for opam/drom_lib.opam

# begin context for opam/drom_toml.opam
Expand Down Expand Up @@ -165,7 +165,7 @@ a44c87f3a364dd95f55427fe40b2c5d1:sphinx/about.rst

# begin context for sphinx/license.rst
# file sphinx/license.rst
8f504f01aea592543c0a662b81169d91:sphinx/license.rst
a02d5245d1626431fbfc4bdb99a413cf:sphinx/license.rst
# end context for sphinx/license.rst

# begin context for src/drom/dune
Expand Down Expand Up @@ -195,7 +195,7 @@ efad88968955023a354f16469eb1ae15:src/drom/dune

# begin context for src/drom_lib/dune
# file src/drom_lib/dune
a97be0d7328e7c15eb149c454844646a:src/drom_lib/dune
114c5e7d70e943b1bfde9e047f037c35:src/drom_lib/dune
# end context for src/drom_lib/dune

# begin context for src/drom_lib/index.mld
Expand All @@ -210,12 +210,12 @@ a97be0d7328e7c15eb149c454844646a:src/drom_lib/dune

# begin context for src/drom_lib/version.mlt
# file src/drom_lib/version.mlt
fc09abbaf032f775d148928fa1398cf9:src/drom_lib/version.mlt
a3e5d8a00664ceaa6addf376bedf6de1:src/drom_lib/version.mlt
# end context for src/drom_lib/version.mlt

# begin context for src/toml.7.1.0/dune
# file src/toml.7.1.0/dune
229a5f90ef7f812db6f3560ccb3d131f:src/toml.7.1.0/dune
449396a4a78c1b552dcef34035479f11:src/toml.7.1.0/dune
# end context for src/toml.7.1.0/dune

# begin context for src/toml.7.1.0/index.mld
Expand All @@ -235,7 +235,7 @@ d1b05207fce876a1b44a8b268bcaf226:src/toml.7.1.0/index.mld

# begin context for src/toml.7.1.0/version.mlt
# file src/toml.7.1.0/version.mlt
fc09abbaf032f775d148928fa1398cf9:src/toml.7.1.0/version.mlt
a3e5d8a00664ceaa6addf376bedf6de1:src/toml.7.1.0/version.mlt
# end context for src/toml.7.1.0/version.mlt

# begin context for test/expect-tests/dune
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2024 OCamlPro SAS
Copyright (c) 2025 OCamlPro SAS

This software is distributed under the terms of the
GNU Lesser General Public License (LGPL) version 2.1 (included below).
Expand Down
3 changes: 2 additions & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@
(depends
(ocaml (>= 4.07.0))
(omd ( >= 2.0 ))
(fpath ( >= 0.7.3 ))
(ez_subst ( >= 0.1 ))
(ez_opam_file (and (>= 0.1.0) (< 1.0.0)))
(ez_file (and (>= 0.3.0) (< 1.0.0)))
(ez_cmdliner (and (>= 0.2.0) (< 1.0.0)))
(drom_toml (= version))
(directories ( >= 0.2 ))
(directories ( >= 0.6 ))
ppx_inline_test
ppx_expect
odoc
Expand Down
3 changes: 2 additions & 1 deletion opam/drom_lib.opam
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ depends: [
"ocaml" {>= "4.07.0"}
"dune" {>= "2.7.0"}
"omd" {>= "2.0"}
"fpath" {>= "0.7.3"}
"ez_subst" {>= "0.1"}
"ez_opam_file" {>= "0.1.0" & < "1.0.0"}
"ez_file" {>= "0.3.0" & < "1.0.0"}
"ez_cmdliner" {>= "0.2.0" & < "1.0.0"}
"drom_toml" {= version}
"directories" {>= "0.2"}
"directories" {>= "0.6"}
"ppx_inline_test" {with-test}
"ppx_expect" {with-test}
"odoc" {with-doc}
Expand Down
2 changes: 1 addition & 1 deletion sphinx/license.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Copyright and License
=====================

Copyright (c) 2024 OCamlPro SAS
Copyright (c) 2025 OCamlPro SAS

This software is distributed under the terms of the
GNU Lesser General Public License (LGPL) version 2.1 (included below).
Expand Down
8 changes: 4 additions & 4 deletions src/drom_lib/commandPackage.ml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ let action ~edit ~package_name ~kind ~dir ?create ~remove ?rename ~args ~files
found := true;
let editor = Globals.editor in
match
Printf.kprintf Sys.command "%s '%s'" editor
Printf.ksprintf Sys.command "%s '%s'" editor
(package.dir // "package.toml")
with
| 0 -> ()
Expand All @@ -168,7 +168,6 @@ let action ~edit ~package_name ~kind ~dir ?create ~remove ?rename ~args ~files
let share = Share.load ~args:share_args ~p () in
let upgrade =
Hashes.with_ctxt ~git:true (fun hashes ->

if remove then begin
if create <> None then
Error.raise "--remove and --create are incompatible";
Expand Down Expand Up @@ -219,8 +218,9 @@ let action ~edit ~package_name ~kind ~dir ?create ~remove ?rename ~args ~files
| [] -> package
| content :: super ->
let package = iter_skeleton super in
let content = Subst.package
(Subst.state () share package) content in
let content =
Subst.package (Subst.state () share package) content
in
Package.of_string ~msg:"package.toml template" content
in
let skeleton = Skeleton.lookup_package share skeleton in
Expand Down
80 changes: 40 additions & 40 deletions src/drom_lib/commandProject.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,47 +22,49 @@ let action ~skeleton ~edit ~args =
begin
match Project.lookup () with
| None ->
Error.raise
"No project found. Maybe you need to create a project first with 'drom \
new PROJECT'"
Error.raise
"No project found. Maybe you need to create a project first with 'drom \
new PROJECT'"
| Some (dir, _) -> (
if edit then
let editor = Globals.editor in
match
Printf.kprintf Sys.command "%s '%s'" editor (dir // "drom.toml")
with
| 0 -> ()
| _ -> Error.raise "Editing command returned a non-zero status" )
if edit then
let editor = Globals.editor in
match
Printf.ksprintf Sys.command "%s '%s'" editor (dir // "drom.toml")
with
| 0 -> ()
| _ -> Error.raise "Editing command returned a non-zero status" )
end;

let project = Project.find () in
match project with
| None -> assert false
| Some (p, _) ->
let args, share_args = args in
let share = Share.load ~args:share_args ~p () in
let args = { args with
arg_share_version = Some share.share_version ;
arg_share_repo = share_args.arg_repo ;
}
in
let skeleton = match skeleton with
| None -> Misc.project_skeleton p.skeleton
| Some skeleton -> skeleton
in
(* Used to check that the project exists. *)
let _sk : skeleton = Skeleton.lookup_project share skeleton in
let args =
{ args with
arg_upgrade =
( if p.skeleton <> Some skeleton then begin
p.skeleton <- Some skeleton;
true
end else
args.arg_upgrade )
}
in
Update.update_files share ~twice:false ~args ~git:true p
let args, share_args = args in
let share = Share.load ~args:share_args ~p () in
let args =
{ args with
arg_share_version = Some share.share_version;
arg_share_repo = share_args.arg_repo
}
in
let skeleton =
match skeleton with
| None -> Misc.project_skeleton p.skeleton
| Some skeleton -> skeleton
in
(* Used to check that the project exists. *)
let _sk : skeleton = Skeleton.lookup_project share skeleton in
let args =
{ args with
arg_upgrade =
( if p.skeleton <> Some skeleton then begin
p.skeleton <- Some skeleton;
true
end else
args.arg_upgrade )
}
in
Update.update_files share ~twice:false ~args ~git:true p

let cmd =
let skeleton = ref None in
Expand All @@ -71,12 +73,10 @@ let cmd =
let edit = ref false in
let args = (update_args, share_args) in
EZCMD.sub cmd_name
(fun () -> action
~skeleton:!skeleton ~edit:!edit ~args)
(fun () -> action ~skeleton:!skeleton ~edit:!edit ~args)
~args:
( update_specs
@ share_specs
@ [ ( [ "library" ],
( update_specs @ share_specs
@ [ ( [ "library" ],
Arg.Unit
(fun () ->
skeleton := Some "library";
Expand Down Expand Up @@ -114,7 +114,7 @@ let cmd =
Arg.Unit (fun () -> update_args.arg_upgrade <- true),
EZCMD.info "Force upgrade of the drom.toml file from the skeleton"
);
([ "edit" ], Arg.Set edit, EZCMD.info "Edit project description");
([ "edit" ], Arg.Set edit, EZCMD.info "Edit project description")
] )
~doc:"Update an existing project"
~man:
Expand Down
2 changes: 1 addition & 1 deletion src/drom_lib/commandPublish.ml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ url {
with
| exn ->
List.iter
(fun dir -> ignore (Printf.kprintf Sys.command "rm -rf %s" dir))
(fun dir -> ignore (Printf.ksprintf Sys.command "rm -rf %s" dir))
!created;
raise exn )
".";
Expand Down
2 changes: 1 addition & 1 deletion src/drom_lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
(name drom_lib)
(public_name drom_lib)
(wrapped true)
(libraries omd ez_subst ez_opam_file ez_file ez_cmdliner drom_toml directories bigarray)
(libraries omd fpath ez_subst ez_opam_file ez_file ez_cmdliner drom_toml directories bigarray)


)
Expand Down
2 changes: 1 addition & 1 deletion src/drom_lib/error.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@

exception Error of string

let raise fmt = Printf.kprintf (fun s -> raise (Error s)) fmt
let raise fmt = Printf.ksprintf (fun s -> raise (Error s)) fmt
6 changes: 3 additions & 3 deletions src/drom_lib/ezToml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ module EZ = struct
match Toml.Parser.from_filename filename with
| `Ok content -> content
| `Error (s, loc) ->
Printf.kprintf failwith "Could not parse %S: %s at %s" filename s
Printf.ksprintf failwith "Could not parse %S: %s at %s" filename s
(string_of_location loc)

let from_string_exn content =
match Toml.Parser.from_string content with
| `Ok content -> content
| `Error (s, loc) ->
Printf.kprintf failwith "Could not parse toml content: %s at %s" s
Printf.ksprintf failwith "Could not parse toml content: %s at %s" s
(string_of_location loc)
end

open TYPES
include EZ

let failwith fmt = Printf.kprintf failwith fmt
let failwith fmt = Printf.ksprintf failwith fmt

let key2str key = String.concat "." key

Expand Down
12 changes: 5 additions & 7 deletions src/drom_lib/globals.ml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ module App_id = struct
end

module Base_dirs = Directories.Base_dirs ()

module Project_dirs = Directories.Project_dirs (App_id)

let home_dir =
Expand All @@ -52,7 +51,7 @@ let home_dir =
Format.eprintf
"Error: can't compute HOME path, make sure it is well defined !@.";
exit 2
| Some home_dir -> home_dir
| Some home_dir -> Fpath.to_string home_dir

let config_dir =
match Project_dirs.config_dir with
Expand All @@ -61,7 +60,7 @@ let config_dir =
"Error: can't compute configuration path, make sure your HOME and other \
environment variables are well defined !@.";
exit 2
| Some config_dir -> config_dir
| Some config_dir -> Fpath.to_string config_dir

let min_drom_version = "0.1"

Expand Down Expand Up @@ -112,8 +111,7 @@ let main_branch = "master"

let key_LGPL2 = "LGPL2"

let default_ci_systems =
[ "ubuntu-latest"; "macos-latest"; "windows-latest" ]
let default_ci_systems = [ "ubuntu-latest"; "macos-latest"; "windows-latest" ]

open EzCompat
open Types
Expand Down Expand Up @@ -155,8 +153,8 @@ let rec dummy_project =
year = (Misc.date ()).Unix.tm_year;
generators = StringSet.empty;
menhir_version = None;
dune_version = current_dune_version ;
project_create = false ;
dune_version = current_dune_version;
project_create = false
}

and dummy_package =
Expand Down
14 changes: 7 additions & 7 deletions src/drom_lib/license.ml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ let load_licenses_dir dir =
let licenses share =
match share.share_licenses with
| None ->
let dir = share.share_dir in
let global_licenses_dir = dir // "licenses" in
let licenses = load_licenses_dir global_licenses_dir in
share.share_licenses <- Some licenses ;
licenses
let dir = share.share_dir in
let global_licenses_dir = dir // "licenses" in
let licenses = load_licenses_dir global_licenses_dir in
share.share_licenses <- Some licenses;
licenses
| Some licenses -> licenses

let known_licenses share =
Expand Down Expand Up @@ -132,7 +132,7 @@ let header share ?(sep = ml_sep) p =
else
Printf.sprintf "%d-%d" p.year current_year
in
[ Printf.kprintf line "Copyright (c) %s %s" years copyright; line "" ]
[ Printf.ksprintf line "Copyright (c) %s %s" years copyright; line "" ]
)
@ [ line "All rights reserved." ]
@ List.map line lines
Expand All @@ -149,7 +149,7 @@ let header_c share p = header ~sep:c_sep share p
let license share p =
let key = p.license in
try
let m = StringMap.find key ( licenses share ) in
let m = StringMap.find key (licenses share) in
m.license_contents
with
| Not_found ->
Expand Down
Loading
Loading