Skip to content

Commit 0245d05

Browse files
authored
Merge pull request #60 from lefessan/z-2020-11-23-fix-skeleton-toml-name
up version to 0.2.0
2 parents 76725ec + 977a978 commit 0245d05

9 files changed

Lines changed: 90 additions & 90 deletions

File tree

.drom

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# hash of toml configuration files
44
# used for generation of all files
5-
a54f1599539c69089fc5e867841802f3:.
5+
71559c6419131ce072ff68d83d359276:.
66
# end context for .
77

88
# begin context for .github/workflows/doc-deploy.yml
@@ -12,7 +12,7 @@ fa97e8d29135d03ad98579323218d9ce:.github/workflows/doc-deploy.yml
1212

1313
# begin context for .github/workflows/workflow.yml
1414
# file .github/workflows/workflow.yml
15-
20a7ac507806f2258bdf8c72d25f19d7:.github/workflows/workflow.yml
15+
2578e01a3fd098263d6d8506582058bd:.github/workflows/workflow.yml
1616
# end context for .github/workflows/workflow.yml
1717

1818
# begin context for .gitignore
@@ -82,7 +82,7 @@ b091dd96e8b553dd7a7df285279d7d9e:README.md
8282

8383
# begin context for drom.opam
8484
# file drom.opam
85-
ee64c3075a8538db8e430a1e1ad14d3d:drom.opam
85+
951188831e6b29ee305ea54caab73f7e:drom.opam
8686
# end context for drom.opam
8787

8888
# begin context for drom.toml
@@ -92,7 +92,7 @@ ee64c3075a8538db8e430a1e1ad14d3d:drom.opam
9292

9393
# begin context for drom_lib.opam
9494
# file drom_lib.opam
95-
16eb05d75ddf91d8aea523005465416a:drom_lib.opam
95+
1927b0d399d665c2b970b4d562d20af5:drom_lib.opam
9696
# end context for drom_lib.opam
9797

9898
# begin context for dune
@@ -102,7 +102,7 @@ ff0b2308dfc7350e6ac7d519836f9e47:dune
102102

103103
# begin context for dune-project
104104
# file dune-project
105-
7b6756c8e6e5798c10edfbe0b34f41e3:dune-project
105+
aa76c66654677b588d8ee450e2394814:dune-project
106106
# end context for dune-project
107107

108108
# begin context for dune_
@@ -187,7 +187,7 @@ dfda02aaec08f18742582243e9cd6748:src/drom_lib/index.mld
187187

188188
# begin context for src/drom_lib/version.ml
189189
# file src/drom_lib/version.ml
190-
fab8224b1866cef1103bca89068b73fe:src/drom_lib/version.ml
190+
608bdb1fe23e8d01fe656ffa9b139bdb:src/drom_lib/version.ml
191191
# end context for src/drom_lib/version.ml
192192

193193
# begin context for test/expect-tests/dune

.github/workflows/workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
os:
1818
- macos-latest
1919
- ubuntu-latest
20-
# - windows-latest
20+
- windows-latest
2121
ocaml-version:
2222
- 4.10.0
2323
skip_test:

drom.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Do not modify or add to the `skip` field of `drom.toml`.
33
opam-version: "2.0"
44
name: "drom"
5-
version: "0.1.0"
5+
version: "0.2.0"
66
license: "LGPL-2.1-only with OCaml-LGPL-linking-exception"
77
synopsis:
88
"The drom tool is a wrapper over opam/dune in an attempt to provide a cargo-like user experience"

drom.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ min-edition = "4.07.0"
1111
mode = "binary"
1212
name = "drom"
1313
synopsis = "The drom tool is a wrapper over opam/dune in an attempt to provide a cargo-like user experience"
14-
version = "0.1.0"
15-
windows-ci = false
14+
version = "0.2.0"
15+
windows-ci = true
1616

1717
# keys that you could also define:
1818
# build-profile = "...build-profile..."

drom_lib.opam

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Do not modify or add to the `skip` field of `drom.toml`.
33
opam-version: "2.0"
44
name: "drom_lib"
5-
version: "0.1.0"
5+
version: "0.2.0"
66
license: "LGPL-2.1-only with OCaml-LGPL-linking-exception"
77
synopsis:
88
"The drom tool is a wrapper over opam/dune in an attempt to provide a cargo-like user experience"
@@ -43,7 +43,7 @@ depends: [
4343
"ocaml" {>= "4.07.0"}
4444
"dune" {>= "2.6.0"}
4545
"toml" {>= "5.0.0" & < "6.0.0"}
46-
"opam-file-format" {>= "2.0.0" & < "3.0.0"}
46+
"opam-file-format" {>= "2.1.1" & < "3.0.0"}
4747
"ez_file" {>= "0.2.0" & < "1.0.0"}
4848
"ez_config" {>= "0.1.0" & < "1.0.0"}
4949
"ez_cmdliner" {>= "0.1.0" & < "1.0.0"}

dune-project

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
(name drom)
44
(allow_approximate_merlin)
55
(generate_opam_files false)
6-
(version 0.1.0)
6+
(version 0.2.0)
77
(formatting (enabled_for ocaml reason))
88

99
(package
@@ -26,7 +26,7 @@
2626
(depends
2727
(ocaml (>= 4.07.0))
2828
(toml (and (>= 5.0.0) (< 6.0.0)))
29-
(opam-file-format (and (>= 2.0.0) (< 3.0.0)))
29+
(opam-file-format (and (>= 2.1.1) (< 3.0.0)))
3030
(ez_file (and (>= 0.2.0) (< 1.0.0)))
3131
(ez_config (and (>= 0.1.0) (< 1.0.0)))
3232
(ez_cmdliner (and (>= 0.1.0) (< 1.0.0)))

src/drom_lib/opam.ml

Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ open Types
1212
open EzFile.OP
1313

1414
module OpamParser = struct
15-
let value_from_string s f =
16-
try OpamParser.value_from_string s f
17-
with exn ->
18-
Printf.eprintf "Error with [%s]:\n" s;
19-
raise exn
15+
module FullPos = struct
16+
let value_from_string s f =
17+
try OpamParser.FullPos.value_from_string s f
18+
with exn ->
19+
Printf.eprintf "Error with [%s]:\n" s;
20+
raise exn
21+
end
2022
end
2123

2224
let dev_repo p =
@@ -26,13 +28,15 @@ let dev_repo p =
2628

2729
let opam_of_project kind package =
2830
let p = package.project in
29-
let open OpamParserTypes in
30-
let file_name = "opam" in
31-
let pos = (file_name, 0, 0) in
32-
let string s = String (pos, s) in
33-
let list v = List (pos, v) in
34-
let var_string s v = Variable (pos, s, string v) in
35-
let var_list s v = Variable (pos, s, list v) in
31+
let open OpamParserTypes.FullPos in
32+
let filename = "opam" in
33+
let pos = { filename ; start = 0,0 ; stop = 0, 0 } in
34+
let elem pelem = { pelem ; pos } in
35+
let string s = elem ( String s ) in
36+
let list v = elem ( List ( elem v )) in
37+
let var s v = elem ( Variable ( elem s, v)) in
38+
let var_string s v = var s ( string v ) in
39+
let var_list s v = var s ( list v ) in
3640
let optionals = ref [] in
3741
let add_optional_string s = function
3842
| None -> ()
@@ -44,20 +48,20 @@ let opam_of_project kind package =
4448
add_optional_string "dev-repo" (dev_repo p);
4549
add_optional_string "tags"
4650
( match p.github_organization with
47-
| None -> None
48-
| Some github_organization ->
49-
Some (Printf.sprintf "org:%s" github_organization) );
51+
| None -> None
52+
| Some github_organization ->
53+
Some (Printf.sprintf "org:%s" github_organization) );
5054

5155
let build_commands =
5256
match kind, package.kind with
5357
| Deps, _
5458
| _, Virtual -> []
5559
| _ ->
56-
[ Variable
57-
( pos,
58-
"build",
59-
OpamParser.value_from_string
60-
{|
60+
[
61+
var "build"
62+
(
63+
OpamParser.FullPos.value_from_string
64+
{|
6165
[
6266
["dune" "subst"] {pinned}
6367
["dune" "build" "-p" name "-j" jobs "@install"
@@ -66,65 +70,61 @@ let opam_of_project kind package =
6670
]
6771
]
6872
|}
69-
file_name )
70-
]
73+
filename )
74+
]
7175
in
7276
let depend_of_dep name d =
7377
let b = Buffer.create 100 in
7478
Printf.bprintf b {| "%s" { |} name;
7579
List.iteri
7680
(fun i version ->
77-
if i > 0 then Printf.bprintf b "& ";
78-
match version with
79-
| Version -> Printf.bprintf b "= version"
80-
| NoVersion -> ()
81-
| Semantic (major, minor, fix) ->
82-
Printf.bprintf b {|>= "%d.%d.%d" & < "%d.0.0" |} major minor fix
83-
(major + 1)
84-
| Lt version -> Printf.bprintf b {| < "%s" |} version
85-
| Le version -> Printf.bprintf b {| <= "%s" |} version
86-
| Eq version -> Printf.bprintf b {| = "%s" |} version
87-
| Ge version -> Printf.bprintf b {| >= "%s" |} version
88-
| Gt version -> Printf.bprintf b {| > "%s" |} version)
81+
if i > 0 then Printf.bprintf b "& ";
82+
match version with
83+
| Version -> Printf.bprintf b "= version"
84+
| NoVersion -> ()
85+
| Semantic (major, minor, fix) ->
86+
Printf.bprintf b {|>= "%d.%d.%d" & < "%d.0.0" |} major minor fix
87+
(major + 1)
88+
| Lt version -> Printf.bprintf b {| < "%s" |} version
89+
| Le version -> Printf.bprintf b {| <= "%s" |} version
90+
| Eq version -> Printf.bprintf b {| = "%s" |} version
91+
| Ge version -> Printf.bprintf b {| >= "%s" |} version
92+
| Gt version -> Printf.bprintf b {| > "%s" |} version)
8993
d.depversions;
9094
if d.deptest then Printf.bprintf b " with-test ";
9195
if d.depdoc then Printf.bprintf b " with-doc ";
9296
Printf.bprintf b "}\n";
9397
(* Printf.eprintf "parse: %s\n%!" s; *)
94-
OpamParser.value_from_string (Buffer.contents b) file_name
98+
OpamParser.FullPos.value_from_string (Buffer.contents b) filename
9599
in
96100
let depends =
97-
[ Variable
98-
( pos,
99-
"depends",
101+
[ var "depends" (
100102
match kind with
101103
| ProgramPart ->
102-
List
103-
( pos,
104-
[ OpamParser.value_from_string
104+
list
105+
[ OpamParser.FullPos.value_from_string
105106
(Printf.sprintf
106107
{|
107108
"%s" { = version }
108109
|}
109110
(Misc.package_lib package))
110-
file_name
111-
] )
111+
filename
112+
]
112113
| Single
113114
| LibraryPart
114115
| Deps ->
115-
List
116-
( pos,
117-
OpamParser.value_from_string
118-
(Printf.sprintf {| "ocaml" { >= "%s" } |} p.min_edition)
119-
file_name
120-
:: OpamParser.value_from_string
121-
(Printf.sprintf {| "dune" { >= "%s" } |}
122-
Globals.current_dune_version)
123-
file_name
124-
:: List.map
125-
(fun (name, d) -> depend_of_dep name d)
126-
(Misc.p_dependencies package)
127-
@ List.map
116+
list
117+
( OpamParser.FullPos.value_from_string
118+
(Printf.sprintf {| "ocaml" { >= "%s" } |} p.min_edition)
119+
filename
120+
:: OpamParser.FullPos.value_from_string
121+
(Printf.sprintf {| "dune" { >= "%s" } |}
122+
Globals.current_dune_version)
123+
filename
124+
:: List.map
125+
(fun (name, d) -> depend_of_dep name d)
126+
(Misc.p_dependencies package)
127+
@ List.map
128128
(fun (name, d) -> depend_of_dep name d)
129129
(Misc.p_tools package) ) )
130130
]
@@ -133,39 +133,39 @@ let opam_of_project kind package =
133133
[ var_string "opam-version" "2.0";
134134
var_string "name"
135135
( match kind with
136-
| LibraryPart -> Misc.package_lib package
137-
| Single
138-
| ProgramPart ->
139-
package.name
140-
| Deps -> package.name );
136+
| LibraryPart -> Misc.package_lib package
137+
| Single
138+
| ProgramPart ->
139+
package.name
140+
| Deps -> package.name );
141141
var_string "version" (Misc.p_version package);
142142
var_string "license" (License.name p);
143143
var_string "synopsis"
144144
( match kind with
145-
| LibraryPart -> Misc.p_synopsis package ^ " (library)"
146-
| Deps -> Misc.p_synopsis package
147-
| Single
148-
| ProgramPart ->
149-
Misc.p_synopsis package );
145+
| LibraryPart -> Misc.p_synopsis package ^ " (library)"
146+
| Deps -> Misc.p_synopsis package
147+
| Single
148+
| ProgramPart ->
149+
Misc.p_synopsis package );
150150
var_string "description" (Misc.p_description package);
151151
var_list "authors" (List.map string (Misc.p_authors package));
152152
var_list "maintainer" (List.map string p.authors)
153153
]
154154
@ List.rev !optionals @ build_commands @ depends
155155
in
156-
let f = { file_contents; file_name } in
157-
let s = OpamPrinter.opamfile f in
156+
let f = { file_contents; file_name = filename } in
157+
let s = OpamPrinter.FullPos.opamfile f in
158158
String.concat "\n"
159159
( [ "# This file was generated by `drom` from `drom.toml`.";
160160
"# Do not modify or add to the `skip` field of `drom.toml`.";
161161
s
162162
]
163-
@
164-
let s = Subst.package_paren ("", package) "opam-trailer" in
165-
if s = "" then
166-
[]
167-
else
168-
[ s ] )
163+
@
164+
let s = Subst.package_paren ("", package) "opam-trailer" in
165+
if s = "" then
166+
[]
167+
else
168+
[ s ] )
169169

170170
let () = Unix.putenv "OPAMCLI" "2.0"
171171

src/drom_lib/package.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ directories = "0.2"
77
ez_cmdliner = "0.1.0"
88
ez_config = "0.1.0"
99
ez_file = "0.2.0"
10-
opam-file-format = "2.0.0"
10+
opam-file-format = "2.1.1"
1111
toml = "5.0.0"
1212
[fields]
1313
dune-libraries = "bigarray"

src/drom_lib/version.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
let version = "0.1.0"
1+
let version = "0.2.0"

0 commit comments

Comments
 (0)