Skip to content
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
13 changes: 13 additions & 0 deletions .github/workflows/js_of_ocaml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,19 @@ jobs:
opam pin add opam-core -n 2.5.1+ox
if: ${{ endsWith(matrix.ocaml-compiler, '+ox') }}

# oxcaml-dune-patches pins dune <= 3.21, but the project requires
# dune >= 3.23. Re-pin the package with the dune version constraint
# stripped — opam re-checks dependency constraints on every install,
# so a one-shot --ignore-constraints-on flag isn't enough.
- name: Drop dune version constraint from oxcaml-dune-patches (OxCaml)
if: ${{ endsWith(matrix.ocaml-compiler, '+ox') }}
run: |
DIR=$(mktemp -d)
opam show --raw oxcaml-dune-patches \
| perl -0777 -pe 's/"dune"\s+\{build & \([^)]+\)\}/"dune" {build}/' \
> "$DIR/oxcaml-dune-patches.opam"
opam pin add oxcaml-dune-patches "$DIR" -k path -n -y

- run: opam install . --deps-only --with-test
# Install the test dependencies
if: ${{ !matrix.skip-test }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
with:
token: ${{ github.token }}
- run: sh tools/make_opam_dune_lint_dir.sh
- run: opam pin -n opam-dune-lint --dev-repo
- uses: ocaml/setup-ocaml/lint-opam@v3

lint-fmt:
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/wasm_of_ocaml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,19 @@ jobs:
opam pin add sedlex -n 3.6+ox
if: ${{ endsWith(matrix.ocaml-compiler, '+ox') }}

# oxcaml-dune-patches pins dune <= 3.21, but the project requires
# dune >= 3.23. Re-pin the package with the dune version constraint
# stripped — opam re-checks dependency constraints on every install,
# so a one-shot --ignore-constraints-on flag isn't enough.
- name: Drop dune version constraint from oxcaml-dune-patches (OxCaml)
if: ${{ endsWith(matrix.ocaml-compiler, '+ox') }}
run: |
DIR=$(mktemp -d)
opam show --raw oxcaml-dune-patches \
| perl -0777 -pe 's/"dune"\s+\{build & \([^)]+\)\}/"dune" {build}/' \
> "$DIR/oxcaml-dune-patches.opam"
opam pin add oxcaml-dune-patches "$DIR" -k path -n -y

# Add some packaged to the opam invariant;
# opam makes wrong choices otherwise
- name: Hold some packages
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.3.2
6.4.0~alpha~dev
2 changes: 1 addition & 1 deletion compiler/tests-compiler/double-translation/dune
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
(action
(with-stdout-to
dune.inc.gen
(run ../gen-rules/gen.exe jsoo_compiler_test))))
(run ../gen-rules/gen.exe compiler/tests-compiler/double-translation))))

(rule
(alias runtest)
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests-compiler/dune
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
(action
(with-stdout-to
dune.inc.gen
(run gen-rules/gen.exe jsoo_compiler_test))))
(run gen-rules/gen.exe compiler/tests-compiler))))

(rule
(alias runtest)
Expand Down
20 changes: 7 additions & 13 deletions compiler/tests-compiler/gen-rules/gen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,14 @@ let is_implem x =

let () = set_binary_mode_out stdout true

(* Project-relative path to this directory, passed by dune *)
let prefix : string =
let rec loop acc rem =
let basename = Filename.basename rem in
let dirname = Filename.dirname rem in
if
String.equal dirname rem
|| String.ends_with ~suffix:"_build" dirname
|| Sys.file_exists (Filename.concat rem "dune-project")
then acc
else
let acc = basename :: acc in
loop acc dirname
in
loop [ "" ] (Sys.getcwd ()) |> String.concat ~sep:"/"
if Array.length Sys.argv < 2
then failwith "gen.exe: expected source directory as first argument";
let p = Sys.argv.(1) in
if String.length p > 0 && not (Char.equal p.[String.length p - 1] '/')
then p ^ "/"
else p

type lang =
| Not of lang
Expand Down
20 changes: 16 additions & 4 deletions compiler/tests-dynlink-wasm/dune
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@

(rule
(target main.out)
(deps plugin.wasmo)
(deps
plugin.wasmo
(glob_files main.bc.wasm.assets/*))
(enabled_if %{env:WASM_OF_OCAML=false})
(action
(with-outputs-to
Expand Down Expand Up @@ -90,7 +92,9 @@

(rule
(target main_compile_and_load.out)
(deps plugin_compiled.wasmo)
(deps
plugin_compiled.wasmo
(glob_files main_compile_and_load.bc.wasm.assets/*))
(enabled_if %{env:WASM_OF_OCAML=false})
(action
(with-outputs-to
Expand All @@ -115,7 +119,10 @@

(rule
(target dynlink_loadfile.out)
(deps plugin.cmo plugin2.cma)
(deps
plugin.cmo
plugin2.cma
(glob_files dynlink_loadfile.bc.wasm.assets/*))
(enabled_if %{env:WASM_OF_OCAML=false})
(action
(with-outputs-to
Expand Down Expand Up @@ -181,7 +188,12 @@

(rule
(target dynlink_loadfile_wp.out)
(deps plugin.cmo plugin2.cma plugin_uses_dep.cmo plugin_js.cmo)
(deps
plugin.cmo
plugin2.cma
plugin_uses_dep.cmo
plugin_js.cmo
(glob_files dynlink_loadfile_wp.assets/*))
(enabled_if %{env:WASM_OF_OCAML=false})
(action
(with-outputs-to
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests-ocaml/basic-io/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
(names wc)
(modes js wasm)
(action
(run node %{test} wc.ml)))
(run node %{test} %{dep:wc.ml})))
2 changes: 2 additions & 0 deletions compiler/tests-ocaml/lib-arg/dune
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
(rule
(target test_rest_all_wasm.ml.corrected)
(enabled_if %{env:WASM_OF_OCAML=false})
(deps
(glob_files ../expect_wasm.bc.wasm.assets/*))
(action
(run node %{dep:../expect_wasm.bc.wasm.js} %{dep:test_rest_all_wasm.ml})))

Expand Down
2 changes: 2 additions & 0 deletions compiler/tests-ocaml/lib-array/dune
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
(rule
(target test_array_wasm.ml.corrected)
(enabled_if %{env:WASM_OF_OCAML=false})
(deps
(glob_files ../expect_wasm.bc.wasm.assets/*))
(action
(run node %{dep:../expect_wasm.bc.wasm.js} %{dep:test_array_wasm.ml})))

Expand Down
2 changes: 2 additions & 0 deletions compiler/tests-ocaml/lib-either/dune
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
(rule
(target test_wasm.ml.corrected)
(enabled_if %{env:WASM_OF_OCAML=false})
(deps
(glob_files ../expect_wasm.bc.wasm.assets/*))
(action
(run node %{dep:../expect_wasm.bc.wasm.js} %{dep:test_wasm.ml})))

Expand Down
2 changes: 2 additions & 0 deletions compiler/tests-ocaml/lib-internalformat/dune
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
(rule
(target test_wasm.ml.corrected)
(enabled_if %{env:WASM_OF_OCAML=false})
(deps
(glob_files ../expect_wasm.bc.wasm.assets/*))
(action
(run node %{dep:../expect_wasm.bc.wasm.js} %{dep:test_wasm.ml})))

Expand Down
2 changes: 2 additions & 0 deletions compiler/tests-ocaml/lib-lazy/dune
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
(rule
(target test_wasm.ml.corrected)
(enabled_if %{env:WASM_OF_OCAML=false})
(deps
(glob_files ../expect_wasm.bc.wasm.assets/*))
(action
(run node %{dep:../expect_wasm.bc.wasm.js} %{dep:test_wasm.ml})))

Expand Down
2 changes: 2 additions & 0 deletions compiler/tests-predef/dune
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
(rule
(target main-wasm.out)
(enabled_if %{env:WASM_OF_OCAML=false})
(deps
(glob_files main.bc.wasm.assets/*))
(action
(with-stdout-to
%{target}
Expand Down
23 changes: 23 additions & 0 deletions compiler/tests-toplevel/dune
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
(flags :standard --toplevel))
(modes byte js))

(rule
(target cmi_include_dirs.txt)
(deps
(package js_of_ocaml-compiler))
(action
(with-stdout-to
%{target}
(run ocamlfind query -format "-I\n%d" -r js_of_ocaml-compiler.dynlink))))

(rule
(targets test_toplevel.js)
(action
Expand All @@ -15,6 +24,7 @@
--toplevel
-w
no-missing-effects-backend
%{read-strings:cmi_include_dirs.txt}
%{dep:test_toplevel.bc}
-o
%{targets})))
Expand Down Expand Up @@ -60,6 +70,16 @@
(action
(copy %{dep:test_toplevel.ml} %{target})))

(rule
(target cmi_include_dirs_wasm.txt)
(deps
(package js_of_ocaml-compiler)
(package wasm_of_ocaml-compiler))
(action
(with-stdout-to
%{target}
(run ocamlfind query -format "-I\n%d" -r wasm_of_ocaml-compiler.dynlink))))

(rule
(targets
test_toplevel_wasm.js
Expand All @@ -71,6 +91,7 @@
--toplevel
-w
no-missing-effects-backend
%{read-strings:cmi_include_dirs_wasm.txt}
%{dep:test_toplevel_wasm.bc}
-o
test_toplevel_wasm.js)))
Expand All @@ -81,6 +102,8 @@
(and
%{env:WASM_OF_OCAML=false}
(>= %{ocaml_version} 5.4)))
(deps
(glob_files test_toplevel_wasm.bc.wasm.assets/*))
(action
(with-stdout-to
%{target}
Expand Down
3 changes: 2 additions & 1 deletion dune-project
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(lang dune 3.20)
(lang dune 3.23)
(using menhir 3.0)
(using directory-targets 0.1)
(using oxcaml 0.1)
Expand All @@ -19,6 +19,7 @@
(description
"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
(dune (>= 3.23.1))
(ocaml (and (>= 4.13) (< 5.6)))
(num :with-test)
(ppx_expect (and (>= v0.16.1) :with-test))
Expand Down
2 changes: 1 addition & 1 deletion js_of_ocaml-compiler.opam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ homepage: "https://ocsigen.org/js_of_ocaml/latest/manual/overview"
doc: "https://ocsigen.org/js_of_ocaml/latest/manual/overview"
bug-reports: "https://github.com/ocsigen/js_of_ocaml/issues"
depends: [
"dune" {>= "3.20"}
"dune" {>= "3.23.1"}
"ocaml" {>= "4.13" & < "5.6"}
"num" {with-test}
"ppx_expect" {>= "v0.16.1" & with-test}
Expand Down
2 changes: 1 addition & 1 deletion js_of_ocaml-lwt.opam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ homepage: "https://ocsigen.org/js_of_ocaml/latest/manual/overview"
doc: "https://ocsigen.org/js_of_ocaml/latest/manual/overview"
bug-reports: "https://github.com/ocsigen/js_of_ocaml/issues"
depends: [
"dune" {>= "3.20"}
"dune" {>= "3.23"}
"ocaml" {>= "4.13"}
"js_of_ocaml" {= version}
"js_of_ocaml-ppx" {= version}
Expand Down
2 changes: 1 addition & 1 deletion js_of_ocaml-ppx.opam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ homepage: "https://ocsigen.org/js_of_ocaml/latest/manual/overview"
doc: "https://ocsigen.org/js_of_ocaml/latest/manual/overview"
bug-reports: "https://github.com/ocsigen/js_of_ocaml/issues"
depends: [
"dune" {>= "3.20"}
"dune" {>= "3.23"}
"ocaml" {>= "4.13"}
"js_of_ocaml" {= version}
"ppxlib" {>= "0.33"}
Expand Down
2 changes: 1 addition & 1 deletion js_of_ocaml-ppx_deriving_json.opam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ homepage: "https://ocsigen.org/js_of_ocaml/latest/manual/overview"
doc: "https://ocsigen.org/js_of_ocaml/latest/manual/overview"
bug-reports: "https://github.com/ocsigen/js_of_ocaml/issues"
depends: [
"dune" {>= "3.20"}
"dune" {>= "3.23"}
"ocaml" {>= "4.13"}
"js_of_ocaml" {= version}
"ppxlib" {>= "0.33"}
Expand Down
2 changes: 1 addition & 1 deletion js_of_ocaml-toplevel.opam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ homepage: "https://ocsigen.org/js_of_ocaml/latest/manual/overview"
doc: "https://ocsigen.org/js_of_ocaml/latest/manual/overview"
bug-reports: "https://github.com/ocsigen/js_of_ocaml/issues"
depends: [
"dune" {>= "3.20"}
"dune" {>= "3.23"}
"ocaml" {>= "4.13"}
"js_of_ocaml-compiler" {= version}
"ocamlfind" {>= "1.5.1"}
Expand Down
2 changes: 1 addition & 1 deletion js_of_ocaml-tyxml.opam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ homepage: "https://ocsigen.org/js_of_ocaml/latest/manual/overview"
doc: "https://ocsigen.org/js_of_ocaml/latest/manual/overview"
bug-reports: "https://github.com/ocsigen/js_of_ocaml/issues"
depends: [
"dune" {>= "3.20"}
"dune" {>= "3.23"}
"ocaml" {>= "4.13"}
"js_of_ocaml" {= version}
"js_of_ocaml-ppx" {= version}
Expand Down
2 changes: 1 addition & 1 deletion js_of_ocaml.opam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ homepage: "https://ocsigen.org/js_of_ocaml/latest/manual/overview"
doc: "https://ocsigen.org/js_of_ocaml/latest/manual/overview"
bug-reports: "https://github.com/ocsigen/js_of_ocaml/issues"
depends: [
"dune" {>= "3.20"}
"dune" {>= "3.23"}
"ocaml" {>= "4.13"}
"js_of_ocaml-compiler" {= version}
"num" {with-test}
Expand Down
2 changes: 1 addition & 1 deletion lib/tests/dune
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
(action
(with-stdout-to
dune.inc.gen
(run gen-rules/gen.exe jsoo_lib_expect_tests))))
(run gen-rules/gen.exe lib/tests))))

(rule
(alias runtest)
Expand Down
20 changes: 7 additions & 13 deletions lib/tests/gen-rules/gen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,14 @@ let is_implem x =

let () = set_binary_mode_out stdout true

(* Project-relative path to this directory, passed by dune *)
let prefix : string =
let rec loop acc rem =
let basename = Filename.basename rem in
let dirname = Filename.dirname rem in
if
String.equal dirname rem
|| String.ends_with ~suffix:"_build" dirname
|| Sys.file_exists (Filename.concat rem "dune-project")
then acc
else
let acc = basename :: acc in
loop acc dirname
in
loop [ "" ] (Sys.getcwd ()) |> String.concat ~sep:"/"
if Array.length Sys.argv < 2
then failwith "gen.exe: expected source directory as first argument";
let p = Sys.argv.(1) in
if String.length p > 0 && not (Char.equal p.[String.length p - 1] '/')
then p ^ "/"
else p

type enabled_if =
| GE5
Expand Down
Loading
Loading