Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

melange: build the stdlib + runtime with Dune #486

Closed
wants to merge 8 commits into from
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
2 changes: 1 addition & 1 deletion .github/workflows/opam-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
working-directory: melange
run: |
env IGNORECONSTRAINTS="melange,mel"
opam pin add dune https://github.com/ocaml/dune.git#0d44bbfdb2a68907a464aeb2dabe95388dac5712
opam pin add dune https://github.com/ocaml/dune.git#2db9840dfe45089d8fc0c61acf887571641dc5a7
opam pin add melange-compiler-libs --dev-repo
opam install luv reason
opam pin add melange . --with-test
Expand Down
9 changes: 5 additions & 4 deletions dune
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@
(install
(package melange)
(dirs
(lib/es6 as runtime/lib/es6)
(lib/js as runtime/lib/js))
(lib/es6 as __MELANGE_RUNTIME__/lib/es6)
(lib/js as __MELANGE_RUNTIME__/lib/js))
(files
(package.json as runtime/package.json)
(bsconfig.json as runtime/bsconfig.json)
(package.json as __MELANGE_RUNTIME__/package.json)
(bsconfig.json as __MELANGE_RUNTIME__/bsconfig.json)
;; while we wait for https://github.com/ocaml/dune/pull/6250
;; dune build lib/artifacts.sexp
;; cp ./_build/default/lib/artifacts.sexp lib/checked-in-artifacts.sexp
(include ./lib/checked-in-artifacts.sexp))
(section lib))


;;;;{BSB GENERATED: NO EDIT

(include dune.mel)
Expand Down
4 changes: 3 additions & 1 deletion dune-project
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
(lang dune 3.5)
(lang dune 3.7)

(using melange 0.1)

(using directory-targets 0.1)

Expand Down
796 changes: 399 additions & 397 deletions dune.mel

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion jscomp/common/js_config.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ let stdlib_path =
in
root // Literals.lib // Literals.package_name
#ifdef BS_RELEASE_BUILD
// Literals.package_name
// Literals.runtime_dir // Literals.package_name
#endif
)

Expand Down
3 changes: 3 additions & 0 deletions jscomp/ext/literals.ml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ let package_name = "melange"
(* Prefix of all melange runtime packages *)
let mel_runtime_package_prefix = "@melange/runtime"

(* Library where we install the melange runtime in opam *)
let runtime_dir = "__MELANGE_RUNTIME__"

(* Name of the library file created for each external dependency. *)
let lib = "lib"
let suffix_cmj = ".cmj"
Expand Down
232 changes: 232 additions & 0 deletions jscomp/others/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
(library
(modes melange)
(name belt)
(public_name melange.belt)
(wrapped false)
(preprocess
(action
(run
melc
-as-pp
-bs-no-check-div-by-zero
-bs-cross-module-opt
%{input-file})))
(libraries bs_stdlib_mini melange_runtime)
(flags :standard \ -keep-locs)
(melange.compile_flags
-no-keep-locs
-bs-no-version-header
-bs-no-check-div-by-zero
-bs-cross-module-opt
-bs-no-builtin-ppx
-unsafe
-nopervasives
-nostdlib
-open
Bs_stdlib_mini
-w
-9-20-61))

; (rule
; (target belt_HashSetString.ml)
; (deps hashset.cppo.ml)
; (action
; (run cppo -D TYPE_STRING %{deps} -o %{target})))

; (rule
; (target belt_HashSetString.mli)
; (deps hashset.cppo.mli)
; (action
; (run cppo -D TYPE_STRING %{deps} -o %{target})))

; (rule
; (target belt_HashSetInt.ml)
; (deps hashset.cppo.ml)
; (action
; (run cppo -D TYPE_INT %{deps} -o %{target})))

; (rule
; (target belt_HashSetInt.mli)
; (deps hashset.cppo.mli)
; (action
; (run cppo -D TYPE_INT %{deps} -o %{target})))

; (rule
; (target belt_HashMapString.ml)
; (deps hashmap.cppo.ml)
; (action
; (run cppo -D TYPE_STRING %{deps} -o %{target})))

; (rule
; (target belt_HashMapString.mli)
; (deps hashmap.cppo.mli)
; (action
; (run cppo -D TYPE_STRING %{deps} -o %{target})))

; (rule
; (target belt_HashMapInt.ml)
; (deps hashmap.cppo.ml)
; (action
; (run cppo -D TYPE_INT %{deps} -o %{target})))

; (rule
; (target belt_HashMapInt.mli)
; (deps hashmap.cppo.mli)
; (action
; (run cppo -D TYPE_INT %{deps} -o %{target})))

; (rule
; (target belt_MapString.ml)
; (deps map.cppo.ml)
; (action
; (run cppo -D TYPE_STRING %{deps} -o %{target})))

; (rule
; (target belt_MapString.mli)
; (deps map.cppo.mli)
; (action
; (run cppo -D TYPE_STRING %{deps} -o %{target})))

; (rule
; (target belt_MapInt.ml)
; (deps map.cppo.ml)
; (action
; (run cppo -D TYPE_INT %{deps} -o %{target})))

; (rule
; (target belt_MapInt.mli)
; (deps map.cppo.mli)
; (action
; (run cppo -D TYPE_INT %{deps} -o %{target})))

; (rule
; (target belt_SetString.ml)
; (deps belt_Set.cppo.ml)
; (action
; (run cppo -D TYPE_STRING %{deps} -o %{target})))

; (rule
; (target belt_SetString.mli)
; (deps belt_Set.cppo.mli)
; (action
; (run cppo -D TYPE_STRING %{deps} -o %{target})))

; (rule
; (target belt_SetInt.ml)
; (deps belt_Set.cppo.ml)
; (action
; (run cppo -D TYPE_INT %{deps} -o %{target})))

; (rule
; (target belt_SetInt.mli)
; (deps belt_Set.cppo.mli)
; (action
; (run cppo -D TYPE_INT %{deps} -o %{target})))

; (rule
; (target belt_MutableMapString.ml)
; (deps mapm.cppo.ml)
; (action
; (run cppo -D TYPE_STRING %{deps} -o %{target})))

; (rule
; (target belt_MutableMapString.mli)
; (deps mapm.cppo.mli)
; (action
; (run cppo -D TYPE_STRING %{deps} -o %{target})))

; (rule
; (target belt_MutableMapInt.ml)
; (deps mapm.cppo.ml)
; (action
; (run cppo -D TYPE_INT %{deps} -o %{target})))

; (rule
; (target belt_MutableMapInt.mli)
; (deps mapm.cppo.mli)
; (action
; (run cppo -D TYPE_INT %{deps} -o %{target})))

; (rule
; (target belt_MutableSetString.ml)
; (deps setm.cppo.ml)
; (action
; (run cppo -D TYPE_STRING %{deps} -o %{target})))

; (rule
; (target belt_MutableSetString.mli)
; (deps setm.cppo.mli)
; (action
; (run cppo -D TYPE_STRING %{deps} -o %{target})))

; (rule
; (target belt_MutableSetInt.ml)
; (deps setm.cppo.ml)
; (action
; (run cppo -D TYPE_INT %{deps} -o %{target})))

; (rule
; (target belt_MutableSetInt.mli)
; (deps setm.cppo.mli)
; (action
; (run cppo -D TYPE_INT %{deps} -o %{target})))

; (rule
; (target belt_SortArrayString.ml)
; (deps sort.cppo.ml)
; (action
; (run cppo -D TYPE_STRING %{deps} -o %{target})))

; (rule
; (target belt_SortArrayString.mli)
; (deps sort.cppo.mli)
; (action
; (run cppo -D TYPE_STRING %{deps} -o %{target})))

; (rule
; (target belt_SortArrayInt.ml)
; (deps sort.cppo.ml)
; (action
; (run cppo -D TYPE_INT %{deps} -o %{target})))

; (rule
; (target belt_SortArrayInt.mli)
; (deps sort.cppo.mli)
; (action
; (run cppo -D TYPE_INT %{deps} -o %{target})))

; (rule
; (target belt_internalMapString.ml)
; (deps internal_map.cppo.ml)
; (action
; (run cppo -D TYPE_STRING %{deps} -o %{target})))

; (rule
; (target belt_internalMapInt.ml)
; (deps internal_map.cppo.ml)
; (action
; (run cppo -D TYPE_INT %{deps} -o %{target})))

; (rule
; (target belt_internalSetString.ml)
; (deps internal_set.cppo.ml)
; (action
; (run cppo -D TYPE_STRING %{deps} -o %{target})))

; (rule
; (target belt_internalSetInt.ml)
; (deps internal_set.cppo.ml)
; (action
; (run cppo -D TYPE_INT %{deps} -o %{target})))

; (rule
; (target js_typed_array.ml)
; (deps js_typed_array.cppo.ml)
; (action
; (run cppo %{deps} -o %{target})))

; (rule
; (target js_typed_array2.ml)
; (deps js_typed_array2.cppo.ml)
; (action
; (run cppo %{deps} -o %{target})))
23 changes: 23 additions & 0 deletions jscomp/runtime/bs_stdlib_mini/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
(library
(modes melange)
(package melange)
(name bs_stdlib_mini)
(flags :standard \ -keep-locs)
(preprocess
(action
(run
melc
-bs-no-check-div-by-zero
-bs-cross-module-opt
-unsafe
--as-pp
%{input-file})))
(melange.compile_flags
-no-keep-locs
-bs-no-version-header
-bs-no-check-div-by-zero
-bs-cross-module-opt
-unsafe
-nopervasives
-nostdlib
-bs-no-builtin-ppx))
Loading