diff --git a/.gitattributes b/.gitattributes index ad70a23062..bac26af878 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,3 +2,16 @@ # decides that the content is text, its line endings are converted to LF on # checkin. When the file has been committed with CRLF, no conversion is done. * text=auto + + +# Mark generated code and documentation as such to exclude them from PR diffs and stats. +# More information: https://github.com/github-linguist/linguist/blob/master/docs/overrides.md#generated-code +src/haz3lweb/Init.ml linguist-generated +src/haz3lweb/exercises/**/*.ml linguist-generated + +hazel.opam linguist-generated +hazel.opam.locked linguist-generated + +*.md linguist-documentation +docs/** linguist-documentation + diff --git a/.github/workflows/deploy_branches.yml b/.github/workflows/deploy_branches.yml index 1281b713db..e97dabb62b 100644 --- a/.github/workflows/deploy_branches.yml +++ b/.github/workflows/deploy_branches.yml @@ -16,34 +16,42 @@ jobs: path: source - name: Add the name of the current branch to the environment as BRANCH_NAME uses: nelonoel/branch-name@v1.0.1 - - name: Retrieve the build environment if cached - id: opam-cache - uses: actions/cache@v2 - with: - path: '/home/runner/.opam/' - key: ${{ runner.os }}-modules-${{ hashFiles('./source/opam.export') }} - name: Set-up OCaml - run: | - sudo apt --assume-yes install curl m4 opam - export OPAMYES=1 - opam init --compiler=ocaml-base-compiler.5.2.0 + uses: ocaml/setup-ocaml@v3 + with: + ocaml-compiler: 5.2.0 + dune-cache: true + - name: Retrieve the switch environment if cached + id: opam-cache-switch + uses: actions/cache@v4 + with: + path: '_opam' + key: ${{ runner.os }}-modules-${{ hashFiles('./source/hazel.opam.locked') }} - name: Install dependencies run: | eval $(opam env) export OPAMYES=1 - make deps + export DUNE_CACHE=enabled + opam install . --deps-only --with-test --locked working-directory: ./source - - name: Build Release + - name: Clean opam switch run: | eval $(opam env) - make release + export OPAMYES=1 + opam clean --all-switches --download-cache --logs --repo-cache --unused-repositories + - name: Build Release + run: | + export DUNE_CACHE=enabled + opam exec -- dune build @src/fmt --auto-promote src --profile release working-directory: ./source - name: Checkout the website build artifacts repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: hazelgrove/build token: ${{ secrets.ACCESS_TOKEN }} path: server + sparse-checkout: | + ${{ env.BRANCH_NAME }} - name: Clear any old build of this branch run: if [ -d "${BRANCH_NAME}" ] ; then rm -rf "${BRANCH_NAME}" ; fi working-directory: ./server diff --git a/.gitignore b/.gitignore index 7916107af5..ec464113b6 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,6 @@ setup.log # unit tests *.xml + +# Backup of opam lock file +hazel.opam.locked.old diff --git a/Makefile b/Makefile index 4d562548f1..96340fa0d5 100644 --- a/Makefile +++ b/Makefile @@ -8,11 +8,14 @@ all: dev deps: opam update - opam switch import opam.export + opam install ./hazel.opam.locked --deps-only --with-test --with-doc change-deps: - opam switch export opam.export - sed -i '' '/host-/d' opam.export # remove host- lines which are arch-specific + opam update + dune build hazel.opam + opam install ./hazel.opam --deps-only --with-test --with-doc + opam lock . + sed -i'.old' '/host-/d' hazel.opam.locked # remove host- lines which are arch-specific. Not using -i '' because of portability issues https://stackoverflow.com/questions/4247068/sed-command-with-i-option-failing-on-mac-but-works-on-linux setup-instructor: cp src/haz3lweb/exercises/settings/ExerciseSettings_instructor.re src/haz3lweb/exercises/settings/ExerciseSettings.re diff --git a/docs/Change-OCaml-Dependencies.md b/docs/Change-OCaml-Dependencies.md new file mode 100644 index 0000000000..34a1d51369 --- /dev/null +++ b/docs/Change-OCaml-Dependencies.md @@ -0,0 +1,12 @@ +# Instructions for Changing Ocaml Dependencies + +## How to update dependencies + +- Update the dune-project file to reflect the new dependency constraints +- `make change-deps` + - This should generate the hazel.opam file from dune. + - Depending on your installed dependencies you may need to make a new clean switch +- Interrogate the `hazel.opam.locked` file to see what dependencies have changed +- `make release` +- Test in Firefox and Chrome. +- Commit changed files and push \ No newline at end of file diff --git a/dune-project b/dune-project index 377674bb15..335194ae48 100644 --- a/dune-project +++ b/dune-project @@ -1,2 +1,44 @@ (lang dune 3.16) (using menhir 2.0) + +(name hazel) + +(generate_opam_files true) + +(source + (github hazelgrove/hazel)) + +(authors "Hazel Development Team") +(maintainers "Hazel Development Team") + +(license MIT) + +(package + (name hazel) + (allow_empty) + (synopsis "Hazel, a live functional programming environment with typed holes") +; (description "A longer description") + ; (tags + ; (topics "to describe" your project)) + (depends + (ocaml + (>= 5.2.0)) + (menhir + (>= 2.0)) + yojson + reason + ppx_yojson_conv_lib + ppx_yojson_conv + incr_dom + (omd (>= 2.0.0~alpha4)) + ezjs_idb + virtual_dom + ppx_deriving + ptmap + uuidm + unionFind + ocamlformat + (junit_alcotest :with-test) + ocaml-lsp-server)) ; After upgrading to opam 2.2 use with-dev https://opam.ocaml.org/blog/opam-2-2-0/ + +; See the complete stanza docs at https://dune.readthedocs.io/en/stable/reference/dune-project/index.html diff --git a/hazel.opam b/hazel.opam new file mode 100644 index 0000000000..36a81b933a --- /dev/null +++ b/hazel.opam @@ -0,0 +1,44 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +synopsis: "Hazel, a live functional programming environment with typed holes" +maintainer: ["Hazel Development Team"] +authors: ["Hazel Development Team"] +license: "MIT" +homepage: "https://github.com/hazelgrove/hazel" +bug-reports: "https://github.com/hazelgrove/hazel/issues" +depends: [ + "dune" {>= "3.16"} + "ocaml" {>= "5.2.0"} + "menhir" {>= "2.0"} + "yojson" + "reason" + "ppx_yojson_conv_lib" + "ppx_yojson_conv" + "incr_dom" + "omd" {>= "2.0.0~alpha4"} + "ezjs_idb" + "virtual_dom" + "ppx_deriving" + "ptmap" + "uuidm" + "unionFind" + "ocamlformat" + "junit_alcotest" {with-test} + "ocaml-lsp-server" + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] +] +dev-repo: "git+https://github.com/hazelgrove/hazel.git" diff --git a/hazel.opam.locked b/hazel.opam.locked new file mode 100644 index 0000000000..31fd8b2c15 --- /dev/null +++ b/hazel.opam.locked @@ -0,0 +1,201 @@ + +opam-version: "2.0" +name: "hazel" +version: "~dev" +synopsis: "Hazel, a live functional programming environment with typed holes" +maintainer: "Hazel Development Team" +authors: "Hazel Development Team" +license: "MIT" +homepage: "https://github.com/hazelgrove/hazel" +bug-reports: "https://github.com/hazelgrove/hazel/issues" +depends: [ + "abstract_algebra" {= "v0.16.0"} + "alcotest" {= "1.8.0" & with-test} + "angstrom" {= "0.16.0"} + "astring" {= "0.8.5"} + "async_js" {= "v0.16.0"} + "async_kernel" {= "v0.16.0"} + "async_rpc_kernel" {= "v0.16.0"} + "base" {= "v0.16.3"} + "base-bigarray" {= "base"} + "base-bytes" {= "base"} + "base-domains" {= "base"} + "base-nnp" {= "base"} + "base-threads" {= "base"} + "base-unix" {= "base"} + "base64" {= "3.5.1"} + "base_bigstring" {= "v0.16.0"} + "base_quickcheck" {= "v0.16.0"} + "bignum" {= "v0.16.0"} + "bigstringaf" {= "0.9.1"} + "bin_prot" {= "v0.16.0"} + "camlp-streams" {= "5.0.1"} + "chrome-trace" {= "3.16.0"} + "cmdliner" {= "1.3.0"} + "conf-bash" {= "1"} + "conf-gmp" {= "4"} + "core" {= "v0.16.2"} + "core_kernel" {= "v0.16.0"} + "cppo" {= "1.6.9"} + "crunch" {= "3.3.1" & with-doc} + "csexp" {= "1.5.2"} + "diffable" {= "v0.16.0"} + "dune" {= "3.16.0"} + "dune-build-info" {= "3.16.0"} + "dune-configurator" {= "3.16.0"} + "dune-rpc" {= "3.16.0"} + "dyn" {= "3.16.0"} + "either" {= "1.0.0"} + "ezjs_idb" {= "0.1.1"} + "ezjs_min" {= "0.3.0"} + "fiber" {= "3.7.0"} + "fieldslib" {= "v0.16.0"} + "fix" {= "20230505"} + "fmt" {= "0.9.0" & with-test} + "fpath" {= "0.7.3"} + "gen" {= "1.1"} + "gen_js_api" {= "1.1.2"} + "incr_dom" {= "v0.16.0"} + "incr_map" {= "v0.16.0"} + "incr_select" {= "v0.16.0"} + "incremental" {= "v0.16.1"} + "int_repr" {= "v0.16.0"} + "jane-street-headers" {= "v0.16.0"} + "janestreet_lru_cache" {= "v0.16.1"} + "js_of_ocaml" {= "5.8.2"} + "js_of_ocaml-compiler" {= "5.8.2"} + "js_of_ocaml-ppx" {= "5.8.2"} + "js_of_ocaml_patches" {= "v0.16.0"} + "jsonrpc" {= "1.19.0"} + "jst-config" {= "v0.16.0"} + "junit" {= "2.0.2" & with-test} + "junit_alcotest" {= "2.0.2" & with-test} + "lambdasoup" {= "1.0.0"} + "lsp" {= "1.19.0"} + "lwt" {= "5.7.0"} + "markup" {= "1.0.3"} + "menhir" {= "20231231"} + "menhirCST" {= "20231231"} + "menhirLib" {= "20231231"} + "menhirSdk" {= "20231231"} + "merlin-extend" {= "0.6.1"} + "merlin-lib" {= "5.1-502"} + "num" {= "1.5"} + "ocaml" {= "5.2.0"} + "ocaml-base-compiler" {= "5.2.0"} + "ocaml-compiler-libs" {= "v0.17.0"} + "ocaml-config" {= "3"} + "ocaml-index" {= "1.0"} + "ocaml-lsp-server" {= "1.19.0"} + "ocaml-options-vanilla" {= "1"} + "ocaml-syntax-shims" {= "1.0.0"} + "ocaml-version" {= "3.6.7"} + "ocamlbuild" {= "0.14.3"} + "ocamlc-loc" {= "3.16.0"} + "ocamlfind" {= "1.9.6"} + "ocamlformat" {= "0.26.2"} + "ocamlformat-lib" {= "0.26.2"} + "ocamlformat-rpc-lib" {= "0.26.2"} + "ocp-indent" {= "1.8.1"} + "ocplib-endian" {= "1.2"} + "octavius" {= "1.2.2"} + "odoc" {= "2.4.2" & with-doc} + "odoc-parser" {= "2.4.2" & with-doc} + "ojs" {= "1.1.2"} + "omd" {= "2.0.0~alpha4"} + "ordering" {= "3.16.0"} + "parsexp" {= "v0.16.0"} + "pp" {= "1.2.0"} + "ppx_assert" {= "v0.16.0"} + "ppx_base" {= "v0.16.0"} + "ppx_bench" {= "v0.16.0"} + "ppx_bin_prot" {= "v0.16.0"} + "ppx_cold" {= "v0.16.0"} + "ppx_compare" {= "v0.16.0"} + "ppx_custom_printf" {= "v0.16.0"} + "ppx_derivers" {= "1.2.1"} + "ppx_deriving" {= "6.0.2"} + "ppx_disable_unused_warnings" {= "v0.16.0"} + "ppx_enumerate" {= "v0.16.0"} + "ppx_expect" {= "v0.16.0"} + "ppx_fields_conv" {= "v0.16.0"} + "ppx_fixed_literal" {= "v0.16.0"} + "ppx_globalize" {= "v0.16.0"} + "ppx_hash" {= "v0.16.0"} + "ppx_here" {= "v0.16.0"} + "ppx_ignore_instrumentation" {= "v0.16.0"} + "ppx_inline_test" {= "v0.16.1"} + "ppx_jane" {= "v0.16.0"} + "ppx_js_style" {= "v0.16.0"} + "ppx_let" {= "v0.16.0"} + "ppx_log" {= "v0.16.0"} + "ppx_module_timer" {= "v0.16.0"} + "ppx_optcomp" {= "v0.16.0"} + "ppx_optional" {= "v0.16.0"} + "ppx_pattern_bind" {= "v0.16.0"} + "ppx_pipebang" {= "v0.16.0"} + "ppx_sexp_conv" {= "v0.16.0"} + "ppx_sexp_message" {= "v0.16.0"} + "ppx_sexp_value" {= "v0.16.0"} + "ppx_stable" {= "v0.16.0"} + "ppx_stable_witness" {= "v0.16.0"} + "ppx_string" {= "v0.16.0"} + "ppx_tydi" {= "v0.16.0"} + "ppx_typerep_conv" {= "v0.16.0"} + "ppx_variants_conv" {= "v0.16.0"} + "ppx_yojson_conv" {= "v0.16.0"} + "ppx_yojson_conv_lib" {= "v0.16.0"} + "ppxlib" {= "0.32.1"} + "protocol_version_header" {= "v0.16.0"} + "ptime" {= "1.1.0" & with-test} + "ptmap" {= "2.0.5"} + "re" {= "1.11.0"} + "reason" {= "3.12.0"} + "result" {= "1.5"} + "sedlex" {= "3.2"} + "seq" {= "base"} + "sexplib" {= "v0.16.0"} + "sexplib0" {= "v0.16.0"} + "spawn" {= "v0.15.1"} + "splittable_random" {= "v0.16.0"} + "stdio" {= "v0.16.0"} + "stdlib-shims" {= "0.3.0"} + "stdune" {= "3.16.0"} + "stored_reversed" {= "v0.16.0"} + "streamable" {= "v0.16.1"} + "stringext" {= "1.6.0"} + "time_now" {= "v0.16.0"} + "topkg" {= "1.0.7"} + "typerep" {= "v0.16.0"} + "tyxml" {= "4.6.0"} + "uchar" {= "0.0.2"} + "unionFind" {= "20220122"} + "uri" {= "4.4.0"} + "uri-sexp" {= "4.4.0"} + "uucp" {= "15.1.0"} + "uuidm" {= "0.9.8"} + "uunf" {= "15.1.0"} + "uuseg" {= "15.1.0"} + "uutf" {= "1.0.3"} + "variantslib" {= "v0.16.0"} + "virtual_dom" {= "v0.16.0"} + "xdg" {= "3.16.0"} + "yojson" {= "2.2.2"} + "zarith" {= "1.13"} + "zarith_stubs_js" {= "v0.16.1"} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] +] +dev-repo: "git+https://github.com/hazelgrove/hazel.git" \ No newline at end of file diff --git a/opam.export b/opam.export deleted file mode 100644 index adcbb591f6..0000000000 --- a/opam.export +++ /dev/null @@ -1,178 +0,0 @@ -opam-version: "2.0" -compiler: ["ocaml-base-compiler.5.2.0"] -roots: [ - "core.v0.16.2" - "ezjs_idb.0.1.1" - "ezjs_min.0.3.0" - "incr_dom.v0.16.0" - "js_of_ocaml-ppx.5.8.2" - "junit_alcotest.2.0.2" - "ocaml-base-compiler.5.2.0" - "ocamlformat.0.26.2" - "omd.2.0.0~alpha4" - "ppx_deriving.6.0.2" - "ppx_let.v0.16.0" - "ppx_sexp_conv.v0.16.0" - "ppx_yojson_conv.v0.16.0" - "ptmap.2.0.5" - "reason.3.11.0" - "sexplib.v0.16.0" - "unionFind.20220122" - "uuidm.0.9.8" - "yojson.2.2.2" -] -installed: [ - "abstract_algebra.v0.16.0" - "alcotest.1.8.0" - "angstrom.0.16.0" - "astring.0.8.5" - "async_js.v0.16.0" - "async_kernel.v0.16.0" - "async_rpc_kernel.v0.16.0" - "base.v0.16.3" - "base-bigarray.base" - "base-bytes.base" - "base-domains.base" - "base-nnp.base" - "base-threads.base" - "base-unix.base" - "base64.3.5.1" - "base_bigstring.v0.16.0" - "base_quickcheck.v0.16.0" - "bignum.v0.16.0" - "bigstringaf.0.9.1" - "bin_prot.v0.16.0" - "camlp-streams.5.0.1" - "cmdliner.1.3.0" - "conf-bash.1" - "conf-gmp.4" - "core.v0.16.2" - "core_kernel.v0.16.0" - "cppo.1.6.9" - "csexp.1.5.2" - "diffable.v0.16.0" - "dune.3.16.0" - "dune-build-info.3.16.0" - "dune-configurator.3.16.0" - "either.1.0.0" - "ezjs_idb.0.1.1" - "ezjs_min.0.3.0" - "fieldslib.v0.16.0" - "fix.20230505" - "fmt.0.9.0" - "fpath.0.7.3" - "gen.1.1" - "gen_js_api.1.1.2" - "incr_dom.v0.16.0" - "incr_map.v0.16.0" - "incr_select.v0.16.0" - "incremental.v0.16.1" - "int_repr.v0.16.0" - "jane-street-headers.v0.16.0" - "janestreet_lru_cache.v0.16.1" - "js_of_ocaml.5.8.2" - "js_of_ocaml-compiler.5.8.2" - "js_of_ocaml-ppx.5.8.2" - "js_of_ocaml_patches.v0.16.0" - "jst-config.v0.16.0" - "junit.2.0.2" - "junit_alcotest.2.0.2" - "lambdasoup.1.0.0" - "markup.1.0.3" - "menhir.20231231" - "menhirCST.20231231" - "menhirLib.20231231" - "menhirSdk.20231231" - "merlin-extend.0.6.1" - "num.1.5" - "ocaml.5.2.0" - "ocaml-base-compiler.5.2.0" - "ocaml-compiler-libs.v0.17.0" - "ocaml-config.3" - "ocaml-options-vanilla.1" - "ocaml-syntax-shims.1.0.0" - "ocaml-version.3.6.7" - "ocamlbuild.0.14.3" - "ocamlfind.1.9.6" - "ocamlformat.0.26.2" - "ocamlformat-lib.0.26.2" - "ocp-indent.1.8.1" - "octavius.1.2.2" - "ojs.1.1.2" - "omd.2.0.0~alpha4" - "parsexp.v0.16.0" - "ppx_assert.v0.16.0" - "ppx_base.v0.16.0" - "ppx_bench.v0.16.0" - "ppx_bin_prot.v0.16.0" - "ppx_cold.v0.16.0" - "ppx_compare.v0.16.0" - "ppx_custom_printf.v0.16.0" - "ppx_derivers.1.2.1" - "ppx_deriving.6.0.2" - "ppx_disable_unused_warnings.v0.16.0" - "ppx_enumerate.v0.16.0" - "ppx_expect.v0.16.0" - "ppx_fields_conv.v0.16.0" - "ppx_fixed_literal.v0.16.0" - "ppx_globalize.v0.16.0" - "ppx_hash.v0.16.0" - "ppx_here.v0.16.0" - "ppx_ignore_instrumentation.v0.16.0" - "ppx_inline_test.v0.16.1" - "ppx_jane.v0.16.0" - "ppx_js_style.v0.16.0" - "ppx_let.v0.16.0" - "ppx_log.v0.16.0" - "ppx_module_timer.v0.16.0" - "ppx_optcomp.v0.16.0" - "ppx_optional.v0.16.0" - "ppx_pattern_bind.v0.16.0" - "ppx_pipebang.v0.16.0" - "ppx_sexp_conv.v0.16.0" - "ppx_sexp_message.v0.16.0" - "ppx_sexp_value.v0.16.0" - "ppx_stable.v0.16.0" - "ppx_stable_witness.v0.16.0" - "ppx_string.v0.16.0" - "ppx_tydi.v0.16.0" - "ppx_typerep_conv.v0.16.0" - "ppx_variants_conv.v0.16.0" - "ppx_yojson_conv.v0.16.0" - "ppx_yojson_conv_lib.v0.16.0" - "ppxlib.0.32.1" - "protocol_version_header.v0.16.0" - "ptime.1.1.0" - "ptmap.2.0.5" - "re.1.11.0" - "reason.3.11.0" - "result.1.5" - "sedlex.3.2" - "seq.base" - "sexplib.v0.16.0" - "sexplib0.v0.16.0" - "splittable_random.v0.16.0" - "stdio.v0.16.0" - "stdlib-shims.0.3.0" - "stored_reversed.v0.16.0" - "streamable.v0.16.1" - "stringext.1.6.0" - "time_now.v0.16.0" - "topkg.1.0.7" - "typerep.v0.16.0" - "tyxml.4.6.0" - "uchar.0.0.2" - "unionFind.20220122" - "uri.4.4.0" - "uri-sexp.4.4.0" - "uucp.15.1.0" - "uuidm.0.9.8" - "uunf.15.1.0" - "uuseg.15.1.0" - "uutf.1.0.3" - "variantslib.v0.16.0" - "virtual_dom.v0.16.0" - "yojson.2.2.2" - "zarith.1.13" - "zarith_stubs_js.v0.16.1" -] diff --git a/src/haz3lweb/app/editors/decoration/Diag.re b/src/haz3lweb/app/editors/decoration/Diag.re index 4b7a815c2e..a145c9d0e9 100644 --- a/src/haz3lweb/app/editors/decoration/Diag.re +++ b/src/haz3lweb/app/editors/decoration/Diag.re @@ -18,24 +18,22 @@ let tr_bl = (), ) => SvgUtil.Path.( - { - let (diag, junction) = - with_child_border - ? ( - L_({dx: Float.neg(short_tip_width), dy: short_tip_height}), - H_({dx: Float.neg(0.5 -. short_tip_width)}), - ) - : ( - L_({dx: Float.neg(tip_width), dy: 0.5 +. stretch_y}), - H_({dx: Float.neg(stretch_x)}), - ); - let path = - switch (hemi) { - | `North => [junction, diag] - | `South => [diag, junction] - }; - scale(s, path); - } + let (diag, junction) = + with_child_border + ? ( + L_({dx: Float.neg(short_tip_width), dy: short_tip_height}), + H_({dx: Float.neg(0.5 -. short_tip_width)}), + ) + : ( + L_({dx: Float.neg(tip_width), dy: 0.5 +. stretch_y}), + H_({dx: Float.neg(stretch_x)}), + ); + let path = + switch (hemi) { + | `North => [junction, diag] + | `South => [diag, junction] + }; + scale(s, path) ); // bottom left to top right let bl_tr = @@ -60,18 +58,16 @@ let tl_br = (), ) => SvgUtil.Path.( - { - let (diag, junction) = - with_child_border - ? ( - L_({dx: short_tip_width, dy: short_tip_height}), - H_({dx: 0.5 -. short_tip_width}), - ) - : (L_({dx: tip_width, dy: 0.5 +. stretch_y}), H_({dx: stretch_x})); - switch (hemi) { - | `North => [junction, diag] - | `South => [diag, junction] - }; + let (diag, junction) = + with_child_border + ? ( + L_({dx: short_tip_width, dy: short_tip_height}), + H_({dx: 0.5 -. short_tip_width}), + ) + : (L_({dx: tip_width, dy: 0.5 +. stretch_y}), H_({dx: stretch_x})); + switch (hemi) { + | `North => [junction, diag] + | `South => [diag, junction] } ); // bottom right to top left