@greenlabs/ppx-spice 0.1.8-rc1 → 0.1.9-rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -2
- package/README.md +4 -0
- package/docs/GUIDE.md +139 -0
- package/package.json +1 -1
- package/ppx-windows.exe +0 -0
- package/.github/workflows/build_linux.yml +0 -41
- package/.github/workflows/build_macos.yml +0 -41
- package/.github/workflows/build_windows.yml +0 -41
- package/.github/workflows/print_esy_cache.js +0 -13
- package/.github/workflows/publish.yml +0 -161
- package/.github/workflows/publish_prerelease.yml +0 -177
- package/.vscode/settings.json +0 -6
- package/src/.ocamlformat +0 -0
- package/src/bin/bin.ml +0 -1
- package/src/bin/dune +0 -5
- package/src/dune +0 -1
- package/src/dune-project +0 -2
- package/src/dune-workspace +0 -3
- package/src/esy.lock/.gitattributes +0 -3
- package/src/esy.lock/.gitignore +0 -3
- package/src/esy.lock/index.json +0 -1196
- package/src/esy.lock/opam/astring.0.8.5/opam +0 -37
- package/src/esy.lock/opam/base-bytes.base/opam +0 -9
- package/src/esy.lock/opam/base-threads.base/opam +0 -6
- package/src/esy.lock/opam/base-unix.base/opam +0 -6
- package/src/esy.lock/opam/base.v0.14.1/opam +0 -36
- package/src/esy.lock/opam/biniou.1.2.1/opam +0 -45
- package/src/esy.lock/opam/cmdliner.1.0.4/opam +0 -36
- package/src/esy.lock/opam/cppo.1.6.8/opam +0 -37
- package/src/esy.lock/opam/csexp.1.5.1/opam +0 -60
- package/src/esy.lock/opam/dot-merlin-reader.4.1/opam +0 -30
- package/src/esy.lock/opam/dune-build-info.2.9.1/opam +0 -42
- package/src/esy.lock/opam/dune-configurator.2.9.1/opam +0 -47
- package/src/esy.lock/opam/dune.2.9.1/opam +0 -58
- package/src/esy.lock/opam/easy-format.1.3.2/opam +0 -46
- package/src/esy.lock/opam/fix.20201120/opam +0 -24
- package/src/esy.lock/opam/fpath.0.7.3/opam +0 -36
- package/src/esy.lock/opam/menhir.20211012/opam +0 -28
- package/src/esy.lock/opam/menhirLib.20211012/opam +0 -29
- package/src/esy.lock/opam/menhirSdk.20211012/opam +0 -29
- package/src/esy.lock/opam/ocaml-compiler-libs.v0.12.4/opam +0 -39
- package/src/esy.lock/opam/ocaml-lsp-server.1.8.3/opam +0 -54
- package/src/esy.lock/opam/ocamlbuild.0.14.0/opam +0 -36
- package/src/esy.lock/opam/ocamlfind.1.9.1/opam +0 -44
- package/src/esy.lock/opam/ocamlformat-rpc-lib.0.18.0/opam +0 -40
- package/src/esy.lock/opam/ocamlformat.0.19.0/opam +0 -55
- package/src/esy.lock/opam/ocp-indent.1.8.1/opam +0 -57
- package/src/esy.lock/opam/odoc-parser.0.9.0/opam +0 -45
- package/src/esy.lock/opam/pp.1.1.2/opam +0 -58
- package/src/esy.lock/opam/ppx_derivers.1.2.1/opam +0 -23
- package/src/esy.lock/opam/ppx_yojson_conv_lib.v0.14.0/opam +0 -24
- package/src/esy.lock/opam/ppxlib.0.23.0/opam +0 -62
- package/src/esy.lock/opam/re.1.10.3/opam +0 -46
- package/src/esy.lock/opam/result.1.5/opam +0 -22
- package/src/esy.lock/opam/seq.base/files/META.seq +0 -4
- package/src/esy.lock/opam/seq.base/files/seq.install +0 -3
- package/src/esy.lock/opam/seq.base/opam +0 -15
- package/src/esy.lock/opam/sexplib0.v0.14.0/opam +0 -26
- package/src/esy.lock/opam/stdio.v0.14.0/opam +0 -27
- package/src/esy.lock/opam/stdlib-shims.0.3.0/opam +0 -31
- package/src/esy.lock/opam/topkg.1.0.4/opam +0 -44
- package/src/esy.lock/opam/uchar.0.0.2/opam +0 -36
- package/src/esy.lock/opam/uucp.14.0.0/opam +0 -41
- package/src/esy.lock/opam/uuseg.14.0.0/opam +0 -43
- package/src/esy.lock/opam/uutf.1.0.2/opam +0 -40
- package/src/esy.lock/opam/yojson.1.7.0/opam +0 -38
- package/src/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/files/ocamlbuild-0.14.0.patch +0 -463
- package/src/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/package.json +0 -27
- package/src/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.1_opam_override/files/findlib-1.9.1.patch +0 -471
- package/src/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.1_opam_override/package.json +0 -61
- package/src/ppx/codecs.ml +0 -120
- package/src/ppx/decode_cases.ml +0 -18
- package/src/ppx/dune +0 -9
- package/src/ppx/polyvariants.ml +0 -288
- package/src/ppx/ppx_spice.ml +0 -19
- package/src/ppx/records.ml +0 -163
- package/src/ppx/signature.ml +0 -86
- package/src/ppx/structure.ml +0 -109
- package/src/ppx/tuple.ml +0 -68
- package/src/ppx/utils.ml +0 -117
- package/src/ppx/variants.ml +0 -257
- package/src/ppx_spice.opam +0 -21
- package/test/__tests__/test_optional_field_records.js +0 -91
- package/test/__tests__/test_optional_field_records.res +0 -98
- package/test/__tests__/test_polyvariants.js +0 -57
- package/test/__tests__/test_polyvariants.res +0 -41
- package/test/__tests__/test_records.js +0 -100
- package/test/__tests__/test_records.res +0 -111
- package/test/__tests__/test_variants.js +0 -85
- package/test/__tests__/test_variants.res +0 -63
- package/test/bsconfig.json +0 -27
- package/test/package.json +0 -18
- package/test/src/OptionalFieldRecords.js +0 -237
- package/test/src/OptionalFieldRecords.res +0 -23
- package/test/src/Polyvariants.js +0 -94
- package/test/src/Polyvariants.res +0 -5
- package/test/src/Polyvariants.resi +0 -5
- package/test/src/Records.js +0 -186
- package/test/src/Records.res +0 -17
- package/test/src/Records.resi +0 -17
- package/test/src/Spice.js +0 -448
- package/test/src/Spice_Codecs.js +0 -57
- package/test/src/Variants.js +0 -115
- package/test/src/Variants.res +0 -11
- package/test/src/Variants.resi +0 -11
- package/test/yarn.lock +0 -4194
|
@@ -1,463 +0,0 @@
|
|
|
1
|
-
--- ./Makefile
|
|
2
|
-
+++ ./Makefile
|
|
3
|
-
@@ -213,7 +213,7 @@
|
|
4
|
-
rm -f man/ocamlbuild.1
|
|
5
|
-
|
|
6
|
-
man/options_man.byte: src/ocamlbuild_pack.cmo
|
|
7
|
-
- $(OCAMLC) $^ -I src man/options_man.ml -o man/options_man.byte
|
|
8
|
-
+ $(OCAMLC) -I +unix unix.cma $^ -I src man/options_man.ml -o man/options_man.byte
|
|
9
|
-
|
|
10
|
-
clean::
|
|
11
|
-
rm -f man/options_man.cm*
|
|
12
|
-
--- ./src/command.ml
|
|
13
|
-
+++ ./src/command.ml
|
|
14
|
-
@@ -148,9 +148,10 @@
|
|
15
|
-
let self = string_of_command_spec_with_calls call_with_tags call_with_target resolve_virtuals in
|
|
16
|
-
let b = Buffer.create 256 in
|
|
17
|
-
(* The best way to prevent bash from switching to its windows-style
|
|
18
|
-
- * quote-handling is to prepend an empty string before the command name. *)
|
|
19
|
-
+ * quote-handling is to prepend an empty string before the command name.
|
|
20
|
-
+ * space seems to work, too - and the ouput is nicer *)
|
|
21
|
-
if Sys.os_type = "Win32" then
|
|
22
|
-
- Buffer.add_string b "''";
|
|
23
|
-
+ Buffer.add_char b ' ';
|
|
24
|
-
let first = ref true in
|
|
25
|
-
let put_space () =
|
|
26
|
-
if !first then
|
|
27
|
-
@@ -260,7 +261,7 @@
|
|
28
|
-
|
|
29
|
-
let execute_many ?(quiet=false) ?(pretend=false) cmds =
|
|
30
|
-
add_parallel_stat (List.length cmds);
|
|
31
|
-
- let degraded = !*My_unix.is_degraded || Sys.os_type = "Win32" in
|
|
32
|
-
+ let degraded = !*My_unix.is_degraded in
|
|
33
|
-
let jobs = !jobs in
|
|
34
|
-
if jobs < 0 then invalid_arg "jobs < 0";
|
|
35
|
-
let max_jobs = if jobs = 0 then None else Some jobs in
|
|
36
|
-
--- ./src/findlib.ml
|
|
37
|
-
+++ ./src/findlib.ml
|
|
38
|
-
@@ -66,9 +66,6 @@
|
|
39
|
-
(fun command -> lexer & Lexing.from_string & run_and_read command)
|
|
40
|
-
command
|
|
41
|
-
|
|
42
|
-
-let run_and_read command =
|
|
43
|
-
- Printf.ksprintf run_and_read command
|
|
44
|
-
-
|
|
45
|
-
let rec query name =
|
|
46
|
-
try
|
|
47
|
-
Hashtbl.find packages name
|
|
48
|
-
@@ -135,7 +132,8 @@
|
|
49
|
-
with Not_found -> s
|
|
50
|
-
|
|
51
|
-
let list () =
|
|
52
|
-
- List.map before_space (split_nl & run_and_read "%s list" ocamlfind)
|
|
53
|
-
+ let cmd = Shell.quote_filename_if_needed ocamlfind ^ " list" in
|
|
54
|
-
+ List.map before_space (split_nl & run_and_read cmd)
|
|
55
|
-
|
|
56
|
-
(* The closure algorithm is easy because the dependencies are already closed
|
|
57
|
-
and sorted for each package. We only have to make the union. We could also
|
|
58
|
-
--- ./src/main.ml
|
|
59
|
-
+++ ./src/main.ml
|
|
60
|
-
@@ -162,6 +162,9 @@
|
|
61
|
-
Tags.mem "traverse" tags
|
|
62
|
-
|| List.exists (Pathname.is_prefix path_name) !Options.include_dirs
|
|
63
|
-
|| List.exists (Pathname.is_prefix path_name) target_dirs)
|
|
64
|
-
+ && ((* beware: !Options.build_dir is an absolute directory *)
|
|
65
|
-
+ Pathname.normalize !Options.build_dir
|
|
66
|
-
+ <> Pathname.normalize (Pathname.pwd/path_name))
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
--- ./src/my_std.ml
|
|
71
|
-
+++ ./src/my_std.ml
|
|
72
|
-
@@ -271,13 +271,107 @@
|
|
73
|
-
try Array.iter (fun x -> if x = basename then raise Exit) a; false
|
|
74
|
-
with Exit -> true
|
|
75
|
-
|
|
76
|
-
+let command_plain = function
|
|
77
|
-
+| [| |] -> 0
|
|
78
|
-
+| margv ->
|
|
79
|
-
+ let rec waitpid a b =
|
|
80
|
-
+ match Unix.waitpid a b with
|
|
81
|
-
+ | exception (Unix.Unix_error(Unix.EINTR,_,_)) -> waitpid a b
|
|
82
|
-
+ | x -> x
|
|
83
|
-
+ in
|
|
84
|
-
+ let pid = Unix.(create_process margv.(0) margv stdin stdout stderr) in
|
|
85
|
-
+ let pid', process_status = waitpid [] pid in
|
|
86
|
-
+ assert (pid = pid');
|
|
87
|
-
+ match process_status with
|
|
88
|
-
+ | Unix.WEXITED n -> n
|
|
89
|
-
+ | Unix.WSIGNALED _ -> 2 (* like OCaml's uncaught exceptions *)
|
|
90
|
-
+ | Unix.WSTOPPED _ -> 127
|
|
91
|
-
+
|
|
92
|
-
+(* can't use Lexers because of circular dependency *)
|
|
93
|
-
+let split_path_win str =
|
|
94
|
-
+ let rec aux pos =
|
|
95
|
-
+ try
|
|
96
|
-
+ let i = String.index_from str pos ';' in
|
|
97
|
-
+ let len = i - pos in
|
|
98
|
-
+ if len = 0 then
|
|
99
|
-
+ aux (succ i)
|
|
100
|
-
+ else
|
|
101
|
-
+ String.sub str pos (i - pos) :: aux (succ i)
|
|
102
|
-
+ with Not_found | Invalid_argument _ ->
|
|
103
|
-
+ let len = String.length str - pos in
|
|
104
|
-
+ if len = 0 then [] else [String.sub str pos len]
|
|
105
|
-
+ in
|
|
106
|
-
+ aux 0
|
|
107
|
-
+
|
|
108
|
-
+let windows_shell = lazy begin
|
|
109
|
-
+ let rec iter = function
|
|
110
|
-
+ | [] -> [| "bash.exe" ; "--norc" ; "--noprofile" |]
|
|
111
|
-
+ | hd::tl ->
|
|
112
|
-
+ let dash = Filename.concat hd "dash.exe" in
|
|
113
|
-
+ if Sys.file_exists dash then [|dash|] else
|
|
114
|
-
+ let bash = Filename.concat hd "bash.exe" in
|
|
115
|
-
+ if Sys.file_exists bash = false then iter tl else
|
|
116
|
-
+ (* if sh.exe and bash.exe exist in the same dir, choose sh.exe *)
|
|
117
|
-
+ let sh = Filename.concat hd "sh.exe" in
|
|
118
|
-
+ if Sys.file_exists sh then [|sh|] else [|bash ; "--norc" ; "--noprofile"|]
|
|
119
|
-
+ in
|
|
120
|
-
+ split_path_win (try Sys.getenv "PATH" with Not_found -> "") |> iter
|
|
121
|
-
+end
|
|
122
|
-
+
|
|
123
|
-
+let prep_windows_cmd cmd =
|
|
124
|
-
+ (* workaround known ocaml bug, remove later *)
|
|
125
|
-
+ if String.contains cmd '\t' && String.contains cmd ' ' = false then
|
|
126
|
-
+ " " ^ cmd
|
|
127
|
-
+ else
|
|
128
|
-
+ cmd
|
|
129
|
-
+
|
|
130
|
-
+let run_with_shell = function
|
|
131
|
-
+| "" -> 0
|
|
132
|
-
+| cmd ->
|
|
133
|
-
+ let cmd = prep_windows_cmd cmd in
|
|
134
|
-
+ let shell = Lazy.force windows_shell in
|
|
135
|
-
+ let qlen = Filename.quote cmd |> String.length in
|
|
136
|
-
+ (* old versions of dash had problems with bs *)
|
|
137
|
-
+ try
|
|
138
|
-
+ if qlen < 7_900 then
|
|
139
|
-
+ command_plain (Array.append shell [| "-ec" ; cmd |])
|
|
140
|
-
+ else begin
|
|
141
|
-
+ (* it can still work, if the called command is a cygwin tool *)
|
|
142
|
-
+ let ch_closed = ref false in
|
|
143
|
-
+ let file_deleted = ref false in
|
|
144
|
-
+ let fln,ch =
|
|
145
|
-
+ Filename.open_temp_file
|
|
146
|
-
+ ~mode:[Open_binary]
|
|
147
|
-
+ "ocamlbuildtmp"
|
|
148
|
-
+ ".sh"
|
|
149
|
-
+ in
|
|
150
|
-
+ try
|
|
151
|
-
+ let f_slash = String.map ( fun x -> if x = '\\' then '/' else x ) fln in
|
|
152
|
-
+ output_string ch cmd;
|
|
153
|
-
+ ch_closed:= true;
|
|
154
|
-
+ close_out ch;
|
|
155
|
-
+ let ret = command_plain (Array.append shell [| "-e" ; f_slash |]) in
|
|
156
|
-
+ file_deleted:= true;
|
|
157
|
-
+ Sys.remove fln;
|
|
158
|
-
+ ret
|
|
159
|
-
+ with
|
|
160
|
-
+ | x ->
|
|
161
|
-
+ if !ch_closed = false then
|
|
162
|
-
+ close_out_noerr ch;
|
|
163
|
-
+ if !file_deleted = false then
|
|
164
|
-
+ (try Sys.remove fln with _ -> ());
|
|
165
|
-
+ raise x
|
|
166
|
-
+ end
|
|
167
|
-
+ with
|
|
168
|
-
+ | (Unix.Unix_error _) as x ->
|
|
169
|
-
+ (* Sys.command doesn't raise an exception, so run_with_shell also won't
|
|
170
|
-
+ raise *)
|
|
171
|
-
+ Printexc.to_string x ^ ":" ^ cmd |> prerr_endline;
|
|
172
|
-
+ 1
|
|
173
|
-
+
|
|
174
|
-
let sys_command =
|
|
175
|
-
- match Sys.os_type with
|
|
176
|
-
- | "Win32" -> fun cmd ->
|
|
177
|
-
- if cmd = "" then 0 else
|
|
178
|
-
- let cmd = "bash --norc -c " ^ Filename.quote cmd in
|
|
179
|
-
- Sys.command cmd
|
|
180
|
-
- | _ -> fun cmd -> if cmd = "" then 0 else Sys.command cmd
|
|
181
|
-
+ if Sys.win32 then run_with_shell
|
|
182
|
-
+ else fun cmd -> if cmd = "" then 0 else Sys.command cmd
|
|
183
|
-
|
|
184
|
-
(* FIXME warning fix and use Filename.concat *)
|
|
185
|
-
let filename_concat x y =
|
|
186
|
-
--- ./src/my_std.mli
|
|
187
|
-
+++ ./src/my_std.mli
|
|
188
|
-
@@ -69,3 +69,6 @@
|
|
189
|
-
|
|
190
|
-
val split_ocaml_version : (int * int * int * string) option
|
|
191
|
-
(** (major, minor, patchlevel, rest) *)
|
|
192
|
-
+
|
|
193
|
-
+val windows_shell : string array Lazy.t
|
|
194
|
-
+val prep_windows_cmd : string -> string
|
|
195
|
-
--- ./src/ocamlbuild_executor.ml
|
|
196
|
-
+++ ./src/ocamlbuild_executor.ml
|
|
197
|
-
@@ -34,6 +34,8 @@
|
|
198
|
-
job_stdin : out_channel;
|
|
199
|
-
job_stderr : in_channel;
|
|
200
|
-
job_buffer : Buffer.t;
|
|
201
|
-
+ job_pid : int;
|
|
202
|
-
+ job_tmp_file: string option;
|
|
203
|
-
mutable job_dying : bool;
|
|
204
|
-
};;
|
|
205
|
-
|
|
206
|
-
@@ -76,6 +78,61 @@
|
|
207
|
-
in
|
|
208
|
-
loop 0
|
|
209
|
-
;;
|
|
210
|
-
+
|
|
211
|
-
+let open_process_full_win cmd env =
|
|
212
|
-
+ let (in_read, in_write) = Unix.pipe () in
|
|
213
|
-
+ let (out_read, out_write) = Unix.pipe () in
|
|
214
|
-
+ let (err_read, err_write) = Unix.pipe () in
|
|
215
|
-
+ Unix.set_close_on_exec in_read;
|
|
216
|
-
+ Unix.set_close_on_exec out_write;
|
|
217
|
-
+ Unix.set_close_on_exec err_read;
|
|
218
|
-
+ let inchan = Unix.in_channel_of_descr in_read in
|
|
219
|
-
+ let outchan = Unix.out_channel_of_descr out_write in
|
|
220
|
-
+ let errchan = Unix.in_channel_of_descr err_read in
|
|
221
|
-
+ let shell = Lazy.force Ocamlbuild_pack.My_std.windows_shell in
|
|
222
|
-
+ let test_cmd =
|
|
223
|
-
+ String.concat " " (List.map Filename.quote (Array.to_list shell)) ^
|
|
224
|
-
+ "-ec " ^
|
|
225
|
-
+ Filename.quote (Ocamlbuild_pack.My_std.prep_windows_cmd cmd) in
|
|
226
|
-
+ let argv,tmp_file =
|
|
227
|
-
+ if String.length test_cmd < 7_900 then
|
|
228
|
-
+ Array.append
|
|
229
|
-
+ shell
|
|
230
|
-
+ [| "-ec" ; Ocamlbuild_pack.My_std.prep_windows_cmd cmd |],None
|
|
231
|
-
+ else
|
|
232
|
-
+ let fln,ch = Filename.open_temp_file ~mode:[Open_binary] "ocamlbuild" ".sh" in
|
|
233
|
-
+ output_string ch (Ocamlbuild_pack.My_std.prep_windows_cmd cmd);
|
|
234
|
-
+ close_out ch;
|
|
235
|
-
+ let fln' = String.map (function '\\' -> '/' | c -> c) fln in
|
|
236
|
-
+ Array.append
|
|
237
|
-
+ shell
|
|
238
|
-
+ [| "-c" ; fln' |], Some fln in
|
|
239
|
-
+ let pid =
|
|
240
|
-
+ Unix.create_process_env argv.(0) argv env out_read in_write err_write in
|
|
241
|
-
+ Unix.close out_read;
|
|
242
|
-
+ Unix.close in_write;
|
|
243
|
-
+ Unix.close err_write;
|
|
244
|
-
+ (pid, inchan, outchan, errchan,tmp_file)
|
|
245
|
-
+
|
|
246
|
-
+let close_process_full_win (pid,inchan, outchan, errchan, tmp_file) =
|
|
247
|
-
+ let delete tmp_file =
|
|
248
|
-
+ match tmp_file with
|
|
249
|
-
+ | None -> ()
|
|
250
|
-
+ | Some x -> try Sys.remove x with Sys_error _ -> () in
|
|
251
|
-
+ let tmp_file_deleted = ref false in
|
|
252
|
-
+ try
|
|
253
|
-
+ close_in inchan;
|
|
254
|
-
+ close_out outchan;
|
|
255
|
-
+ close_in errchan;
|
|
256
|
-
+ let res = snd(Unix.waitpid [] pid) in
|
|
257
|
-
+ tmp_file_deleted := true;
|
|
258
|
-
+ delete tmp_file;
|
|
259
|
-
+ res
|
|
260
|
-
+ with
|
|
261
|
-
+ | x when tmp_file <> None && !tmp_file_deleted = false ->
|
|
262
|
-
+ delete tmp_file;
|
|
263
|
-
+ raise x
|
|
264
|
-
+
|
|
265
|
-
(* ***)
|
|
266
|
-
(*** execute *)
|
|
267
|
-
(* XXX: Add test for non reentrancy *)
|
|
268
|
-
@@ -130,10 +187,16 @@
|
|
269
|
-
(*** add_job *)
|
|
270
|
-
let add_job cmd rest result id =
|
|
271
|
-
(*display begin fun oc -> fp oc "Job %a is %s\n%!" print_job_id id cmd; end;*)
|
|
272
|
-
- let (stdout', stdin', stderr') = open_process_full cmd env in
|
|
273
|
-
+ let (pid,stdout', stdin', stderr', tmp_file) =
|
|
274
|
-
+ if Sys.win32 then open_process_full_win cmd env else
|
|
275
|
-
+ let a,b,c = open_process_full cmd env in
|
|
276
|
-
+ -1,a,b,c,None
|
|
277
|
-
+ in
|
|
278
|
-
incr jobs_active;
|
|
279
|
-
- set_nonblock (doi stdout');
|
|
280
|
-
- set_nonblock (doi stderr');
|
|
281
|
-
+ if not Sys.win32 then (
|
|
282
|
-
+ set_nonblock (doi stdout');
|
|
283
|
-
+ set_nonblock (doi stderr');
|
|
284
|
-
+ );
|
|
285
|
-
let job =
|
|
286
|
-
{ job_id = id;
|
|
287
|
-
job_command = cmd;
|
|
288
|
-
@@ -143,7 +206,9 @@
|
|
289
|
-
job_stdin = stdin';
|
|
290
|
-
job_stderr = stderr';
|
|
291
|
-
job_buffer = Buffer.create 1024;
|
|
292
|
-
- job_dying = false }
|
|
293
|
-
+ job_dying = false;
|
|
294
|
-
+ job_tmp_file = tmp_file;
|
|
295
|
-
+ job_pid = pid }
|
|
296
|
-
in
|
|
297
|
-
outputs := FDM.add (doi stdout') job (FDM.add (doi stderr') job !outputs);
|
|
298
|
-
jobs := JS.add job !jobs;
|
|
299
|
-
@@ -199,6 +264,7 @@
|
|
300
|
-
try
|
|
301
|
-
read fd u 0 (Bytes.length u)
|
|
302
|
-
with
|
|
303
|
-
+ | Unix.Unix_error(Unix.EPIPE,_,_) when Sys.win32 -> 0
|
|
304
|
-
| Unix.Unix_error(e,_,_) ->
|
|
305
|
-
let msg = error_message e in
|
|
306
|
-
display (fun oc -> fp oc
|
|
307
|
-
@@ -241,14 +307,19 @@
|
|
308
|
-
decr jobs_active;
|
|
309
|
-
|
|
310
|
-
(* PR#5371: we would get EAGAIN below otherwise *)
|
|
311
|
-
- clear_nonblock (doi job.job_stdout);
|
|
312
|
-
- clear_nonblock (doi job.job_stderr);
|
|
313
|
-
-
|
|
314
|
-
+ if not Sys.win32 then (
|
|
315
|
-
+ clear_nonblock (doi job.job_stdout);
|
|
316
|
-
+ clear_nonblock (doi job.job_stderr);
|
|
317
|
-
+ );
|
|
318
|
-
do_read ~loop:true (doi job.job_stdout) job;
|
|
319
|
-
do_read ~loop:true (doi job.job_stderr) job;
|
|
320
|
-
outputs := FDM.remove (doi job.job_stdout) (FDM.remove (doi job.job_stderr) !outputs);
|
|
321
|
-
jobs := JS.remove job !jobs;
|
|
322
|
-
- let status = close_process_full (job.job_stdout, job.job_stdin, job.job_stderr) in
|
|
323
|
-
+ let status =
|
|
324
|
-
+ if Sys.win32 then
|
|
325
|
-
+ close_process_full_win (job.job_pid, job.job_stdout, job.job_stdin, job.job_stderr, job.job_tmp_file)
|
|
326
|
-
+ else
|
|
327
|
-
+ close_process_full (job.job_stdout, job.job_stdin, job.job_stderr) in
|
|
328
|
-
|
|
329
|
-
let shown = ref false in
|
|
330
|
-
|
|
331
|
-
--- ./src/ocamlbuild_unix_plugin.ml
|
|
332
|
-
+++ ./src/ocamlbuild_unix_plugin.ml
|
|
333
|
-
@@ -48,12 +48,22 @@
|
|
334
|
-
end
|
|
335
|
-
|
|
336
|
-
let run_and_open s kont =
|
|
337
|
-
+ let s_orig = s in
|
|
338
|
-
+ let s =
|
|
339
|
-
+ (* Be consistent! My_unix.run_and_open uses My_std.sys_command and
|
|
340
|
-
+ sys_command uses bash. *)
|
|
341
|
-
+ if Sys.win32 = false then s else
|
|
342
|
-
+ let l = match Lazy.force My_std.windows_shell |> Array.to_list with
|
|
343
|
-
+ | hd::tl -> (Filename.quote hd)::tl
|
|
344
|
-
+ | _ -> assert false in
|
|
345
|
-
+ "\"" ^ (String.concat " " l) ^ " -ec " ^ Filename.quote (" " ^ s) ^ "\""
|
|
346
|
-
+ in
|
|
347
|
-
let ic = Unix.open_process_in s in
|
|
348
|
-
let close () =
|
|
349
|
-
match Unix.close_process_in ic with
|
|
350
|
-
| Unix.WEXITED 0 -> ()
|
|
351
|
-
| Unix.WEXITED _ | Unix.WSIGNALED _ | Unix.WSTOPPED _ ->
|
|
352
|
-
- failwith (Printf.sprintf "Error while running: %s" s) in
|
|
353
|
-
+ failwith (Printf.sprintf "Error while running: %s" s_orig) in
|
|
354
|
-
let res = try
|
|
355
|
-
kont ic
|
|
356
|
-
with e -> (close (); raise e)
|
|
357
|
-
--- ./src/options.ml
|
|
358
|
-
+++ ./src/options.ml
|
|
359
|
-
@@ -174,11 +174,24 @@
|
|
360
|
-
build_dir := Filename.concat (Sys.getcwd ()) s
|
|
361
|
-
else
|
|
362
|
-
build_dir := s
|
|
363
|
-
+
|
|
364
|
-
+let slashify =
|
|
365
|
-
+ if Sys.win32 then fun p -> String.map (function '\\' -> '/' | x -> x) p
|
|
366
|
-
+ else fun p ->p
|
|
367
|
-
+
|
|
368
|
-
+let sb () =
|
|
369
|
-
+ match Sys.os_type with
|
|
370
|
-
+ | "Win32" ->
|
|
371
|
-
+ (try set_binary_mode_out stdout true with _ -> ());
|
|
372
|
-
+ | _ -> ()
|
|
373
|
-
+
|
|
374
|
-
+
|
|
375
|
-
let spec = ref (
|
|
376
|
-
let print_version () =
|
|
377
|
-
+ sb ();
|
|
378
|
-
Printf.printf "ocamlbuild %s\n%!" Ocamlbuild_config.version; raise Exit_OK
|
|
379
|
-
in
|
|
380
|
-
- let print_vnum () = print_endline Ocamlbuild_config.version; raise Exit_OK in
|
|
381
|
-
+ let print_vnum () = sb (); print_endline Ocamlbuild_config.version; raise Exit_OK in
|
|
382
|
-
Arg.align
|
|
383
|
-
[
|
|
384
|
-
"-version", Unit print_version , " Display the version";
|
|
385
|
-
@@ -257,8 +270,8 @@
|
|
386
|
-
"-build-dir", String set_build_dir, "<path> Set build directory (implies no-links)";
|
|
387
|
-
"-install-lib-dir", Set_string Ocamlbuild_where.libdir, "<path> Set the install library directory";
|
|
388
|
-
"-install-bin-dir", Set_string Ocamlbuild_where.bindir, "<path> Set the install binary directory";
|
|
389
|
-
- "-where", Unit (fun () -> print_endline !Ocamlbuild_where.libdir; raise Exit_OK), " Display the install library directory";
|
|
390
|
-
- "-which", String (fun cmd -> print_endline (find_tool cmd); raise Exit_OK), "<command> Display path to the tool command";
|
|
391
|
-
+ "-where", Unit (fun () -> sb (); print_endline (slashify !Ocamlbuild_where.libdir); raise Exit_OK), " Display the install library directory";
|
|
392
|
-
+ "-which", String (fun cmd -> sb (); print_endline (slashify (find_tool cmd)); raise Exit_OK), "<command> Display path to the tool command";
|
|
393
|
-
"-ocamlc", set_cmd ocamlc, "<command> Set the OCaml bytecode compiler";
|
|
394
|
-
"-plugin-ocamlc", set_cmd plugin_ocamlc, "<command> Set the OCaml bytecode compiler \
|
|
395
|
-
used when building myocamlbuild.ml (only)";
|
|
396
|
-
--- ./src/pathname.ml
|
|
397
|
-
+++ ./src/pathname.ml
|
|
398
|
-
@@ -84,6 +84,26 @@
|
|
399
|
-
| x :: xs -> x :: normalize_list xs
|
|
400
|
-
|
|
401
|
-
let normalize x =
|
|
402
|
-
+ let x =
|
|
403
|
-
+ if Sys.win32 = false then
|
|
404
|
-
+ x
|
|
405
|
-
+ else
|
|
406
|
-
+ let len = String.length x in
|
|
407
|
-
+ let b = Bytes.create len in
|
|
408
|
-
+ for i = 0 to pred len do
|
|
409
|
-
+ match x.[i] with
|
|
410
|
-
+ | '\\' -> Bytes.set b i '/'
|
|
411
|
-
+ | c -> Bytes.set b i c
|
|
412
|
-
+ done;
|
|
413
|
-
+ if len > 1 then (
|
|
414
|
-
+ let c1 = Bytes.get b 0 in
|
|
415
|
-
+ let c2 = Bytes.get b 1 in
|
|
416
|
-
+ if c2 = ':' && c1 >= 'a' && c1 <= 'z' &&
|
|
417
|
-
+ ( len = 2 || Bytes.get b 2 = '/') then
|
|
418
|
-
+ Bytes.set b 0 (Char.uppercase_ascii c1)
|
|
419
|
-
+ );
|
|
420
|
-
+ Bytes.unsafe_to_string b
|
|
421
|
-
+ in
|
|
422
|
-
if Glob.eval not_normal_form_re x then
|
|
423
|
-
let root, paths = split x in
|
|
424
|
-
join root (normalize_list paths)
|
|
425
|
-
--- ./src/shell.ml
|
|
426
|
-
+++ ./src/shell.ml
|
|
427
|
-
@@ -24,12 +24,26 @@
|
|
428
|
-
| 'a'..'z' | 'A'..'Z' | '0'..'9' | '.' | '-' | '/' | '_' | ':' | '@' | '+' | ',' -> loop (pos + 1)
|
|
429
|
-
| _ -> false in
|
|
430
|
-
loop 0
|
|
431
|
-
+
|
|
432
|
-
+let generic_quote quotequote s =
|
|
433
|
-
+ let l = String.length s in
|
|
434
|
-
+ let b = Buffer.create (l + 20) in
|
|
435
|
-
+ Buffer.add_char b '\'';
|
|
436
|
-
+ for i = 0 to l - 1 do
|
|
437
|
-
+ if s.[i] = '\''
|
|
438
|
-
+ then Buffer.add_string b quotequote
|
|
439
|
-
+ else Buffer.add_char b s.[i]
|
|
440
|
-
+ done;
|
|
441
|
-
+ Buffer.add_char b '\'';
|
|
442
|
-
+ Buffer.contents b
|
|
443
|
-
+let unix_quote = generic_quote "'\\''"
|
|
444
|
-
+
|
|
445
|
-
let quote_filename_if_needed s =
|
|
446
|
-
if is_simple_filename s then s
|
|
447
|
-
(* We should probably be using [Filename.unix_quote] except that function
|
|
448
|
-
* isn't exported. Users on Windows will have to live with not being able to
|
|
449
|
-
* install OCaml into c:\o'caml. Too bad. *)
|
|
450
|
-
- else if Sys.os_type = "Win32" then Printf.sprintf "'%s'" s
|
|
451
|
-
+ else if Sys.os_type = "Win32" then unix_quote s
|
|
452
|
-
else Filename.quote s
|
|
453
|
-
let chdir dir =
|
|
454
|
-
reset_filesys_cache ();
|
|
455
|
-
@@ -37,7 +51,7 @@
|
|
456
|
-
let run args target =
|
|
457
|
-
reset_readdir_cache ();
|
|
458
|
-
let cmd = String.concat " " (List.map quote_filename_if_needed args) in
|
|
459
|
-
- if !*My_unix.is_degraded || Sys.os_type = "Win32" then
|
|
460
|
-
+ if !*My_unix.is_degraded then
|
|
461
|
-
begin
|
|
462
|
-
Log.event cmd target Tags.empty;
|
|
463
|
-
let st = sys_command cmd in
|
package/src/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/package.json
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"build": [
|
|
3
|
-
[
|
|
4
|
-
"bash",
|
|
5
|
-
"-c",
|
|
6
|
-
"#{os == 'windows' ? 'patch -p1 < ocamlbuild-0.14.0.patch' : 'true'}"
|
|
7
|
-
],
|
|
8
|
-
[
|
|
9
|
-
"make",
|
|
10
|
-
"-f",
|
|
11
|
-
"configure.make",
|
|
12
|
-
"all",
|
|
13
|
-
"OCAMLBUILD_PREFIX=#{self.install}",
|
|
14
|
-
"OCAMLBUILD_BINDIR=#{self.bin}",
|
|
15
|
-
"OCAMLBUILD_LIBDIR=#{self.lib}",
|
|
16
|
-
"OCAMLBUILD_MANDIR=#{self.man}",
|
|
17
|
-
"OCAMLBUILD_NATIVE=true",
|
|
18
|
-
"OCAMLBUILD_NATIVE_TOOLS=true"
|
|
19
|
-
],
|
|
20
|
-
[
|
|
21
|
-
"make",
|
|
22
|
-
"check-if-preinstalled",
|
|
23
|
-
"all",
|
|
24
|
-
"#{os == 'windows' ? 'install' : 'opam-install'}"
|
|
25
|
-
]
|
|
26
|
-
]
|
|
27
|
-
}
|