From 9810fa7bc972a028b535c0667688b5d3fd265c7f Mon Sep 17 00:00:00 2001 From: Nicolas Berthier Date: Fri, 12 Jun 2026 10:22:35 +0200 Subject: [PATCH] Use drom.0.9.3 & drom-share.0.9.3 Additional: - Increase version to 0.4.1 - Use OCaml.4.14.2 edition (min available on windows) - Use OCaml.4.11.0 min-edition (min available in opam repository) - Remove dependency on `ocamlformat` - Enable Windows CI --- .drom | 79 ++++++++++++++-------------- .github/workflows/workflow.yml | 50 ++++++++++-------- .gitignore | 1 - .vscode/settings.json | 6 +++ .vscode/tasks.json | 25 +++++++++ Makefile | 88 +------------------------------- Makefile.drom | 83 ++++++++++++++++++++++++++++++ docs/index.html | 5 +- drom.toml | 28 ++++++---- dune-project | 17 +++--- opam/ez_file.opam | 11 ++-- scripts/copy-bin.sh | 2 +- scripts/static-build.sh | 27 ++++++++++ sphinx/install.rst | 4 +- src/ez_file/dune | 5 ++ src/ez_file/package.toml | 2 +- test/expect-tests/dune | 11 +--- test/expect-tests/dune.drom | 14 +++++ test/inline-tests/dune | 9 ---- test/inline-tests/test.ml | 8 --- test/output-tests/dune | 37 -------------- test/output-tests/test1.expected | 1 - test/output-tests/test2.expected | 1 - test/output-tests/test2.ml | 3 -- 24 files changed, 271 insertions(+), 246 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json create mode 100644 Makefile.drom create mode 100755 scripts/static-build.sh create mode 100644 test/expect-tests/dune.drom delete mode 100644 test/inline-tests/dune delete mode 100644 test/inline-tests/test.ml delete mode 100644 test/output-tests/dune delete mode 100644 test/output-tests/test1.expected delete mode 100644 test/output-tests/test2.expected delete mode 100644 test/output-tests/test2.ml diff --git a/.drom b/.drom index 7932006..d8bcf85 100644 --- a/.drom +++ b/.drom @@ -5,7 +5,7 @@ version:0.9.0 # hash of toml configuration files # used for generation of all files -9aa97f19d5f4d407d8d3ee24f5aab0c5:. +95833d0bdbcee78f882a5a625ed0d0e4:. # end context for . # begin context for .github/workflows/ci.ml @@ -15,12 +15,12 @@ ac2aab1d8f78befbbfca730668f71e8d:.github/workflows/ci.ml # begin context for .github/workflows/workflow.yml # file .github/workflows/workflow.yml -0ccff850a6ed3d421d1a75eee435bc14:.github/workflows/workflow.yml +6b1ee9e0d62afe299c8fe62efa42c21d:.github/workflows/workflow.yml # end context for .github/workflows/workflow.yml # begin context for .gitignore # file .gitignore -4fbab3b9cc53d400585f1f8b93288bfe:.gitignore +b82bcaa637d3f162f45c404af9dd3b4d:.gitignore # end context for .gitignore # begin context for .ocamlformat @@ -38,6 +38,16 @@ c8f70450e7d78c0387644864ffe8cbd5:.ocamlformat-ignore 1281376e351d6c2be9ea4c576a29ebd4:.ocp-indent # end context for .ocp-indent +# begin context for .vscode/settings.json +# file .vscode/settings.json +c3d12805c4eeee16a89bfeee357c8325:.vscode/settings.json +# end context for .vscode/settings.json + +# begin context for .vscode/tasks.json +# file .vscode/tasks.json +7884eee2b10cf89cff5d1e466646b046:.vscode/tasks.json +# end context for .vscode/tasks.json + # begin context for CHANGES.md # file CHANGES.md 7a038eccc259630a7aaa876eceb826ba:CHANGES.md @@ -50,9 +60,14 @@ cdfde087b1ceb33b9c5f9d01ddc08d62:LICENSE.md # begin context for Makefile # file Makefile -af1157fb3599c96e00152d564db64b64:Makefile +05325f8fa82ef34fa0bab395248cc8b3:Makefile # end context for Makefile +# begin context for Makefile.drom +# file Makefile.drom +25061d68284137e2639975011a16b300:Makefile.drom +# end context for Makefile.drom + # begin context for README.md # file README.md b437ded55955d885b421f442f61f59bb:README.md @@ -80,7 +95,7 @@ c37a7235a116dd40fbb23168977dd549:docs/doc/index.html # begin context for docs/index.html # file docs/index.html -2ebaaca3b5699237d9b2b3a92092f2c2:docs/index.html +0677f3ef5de144072f0dda02b8cd7f7e:docs/index.html # end context for docs/index.html # begin context for docs/sphinx/index.html @@ -95,7 +110,7 @@ c8281f46ba9a11d0b61bc8ef67eaa357:docs/style.css # begin context for drom.toml # file drom.toml -61839e8d3bf7209159a62ad2a75f2c66:drom.toml +95d29c77567f1a83f56cd68941308a44:drom.toml # end context for drom.toml # begin context for dune @@ -105,12 +120,14 @@ df544cfaf9078d1bba2f90ed1b5adf5f:dune # begin context for dune-project # file dune-project -6d4cd5636f52fc7edf771a588766bb6c:dune-project +43b99f0e75cf087e6db9f4111d8f91fd:dune-project +416e6e9216aadb14b8d518a6094d828b:dune-project # end context for dune-project # begin context for opam/ez_file.opam # file opam/ez_file.opam -181b3a7dd59114806144fa4c1b4a01b3:opam/ez_file.opam +45cb77a1e984ab8eb84d21ce2b2cf362:opam/ez_file.opam +fce746e3f55c5b5faa25451407842c0a:opam/ez_file.opam # end context for opam/ez_file.opam # begin context for scripts/after.sh @@ -125,9 +142,14 @@ df544cfaf9078d1bba2f90ed1b5adf5f:dune # begin context for scripts/copy-bin.sh # file scripts/copy-bin.sh -bb3a9d286f0dc64021db4194427263ee:scripts/copy-bin.sh +7fe4ada2a2fc5a0ebf9a2f483679a0ae:scripts/copy-bin.sh # end context for scripts/copy-bin.sh +# begin context for scripts/static-build.sh +# file scripts/static-build.sh +cda3f8bad69d9c6e8cbeab1c720d739a:scripts/static-build.sh +# end context for scripts/static-build.sh + # begin context for sphinx/_static/css/fixes.css # file sphinx/_static/css/fixes.css 68b329da9893e34099c7d8ad5cb9c940:sphinx/_static/css/fixes.css @@ -150,7 +172,7 @@ bb3a9d286f0dc64021db4194427263ee:scripts/copy-bin.sh # begin context for sphinx/install.rst # file sphinx/install.rst -51fc8c1636ef901c660808ace2fa032f:sphinx/install.rst +1283ed1cc1357f05e4018c2e41e18103:sphinx/install.rst # end context for sphinx/install.rst # begin context for sphinx/license.rst @@ -160,7 +182,7 @@ bb3a9d286f0dc64021db4194427263ee:scripts/copy-bin.sh # begin context for src/ez_file/dune # file src/ez_file/dune -4ebbfb6c250e6241171b938a4bc7f6c0:src/ez_file/dune +d4c00bd7acad8b3918b729fc6fb153f9:src/ez_file/dune # end context for src/ez_file/dune # begin context for src/ez_file/index.mld @@ -178,37 +200,12 @@ d084e0c0b356453f70a0ab97451d4863:src/ez_file/package.toml e2b4f39fcfb303f845699e550cb89a31:test/expect-tests/dune # end context for test/expect-tests/dune +# begin context for test/expect-tests/dune.drom +# file test/expect-tests/dune.drom +619a1392093d0d7aad989e3d225d719f:test/expect-tests/dune.drom +# end context for test/expect-tests/dune.drom + # begin context for test/expect-tests/test.ml # file test/expect-tests/test.ml 734ed6b2b1cb8e0d6bce316d155bb157:test/expect-tests/test.ml # end context for test/expect-tests/test.ml - -# begin context for test/inline-tests/dune -# file test/inline-tests/dune -f83749a3827aaac58638994a6e6528d1:test/inline-tests/dune -# end context for test/inline-tests/dune - -# begin context for test/inline-tests/test.ml -# file test/inline-tests/test.ml -e001d04969100c711855223ad6c23e6a:test/inline-tests/test.ml -# end context for test/inline-tests/test.ml - -# begin context for test/output-tests/dune -# file test/output-tests/dune -75c72884478404495ffa9485c85ac098:test/output-tests/dune -# end context for test/output-tests/dune - -# begin context for test/output-tests/test1.expected -# file test/output-tests/test1.expected -f0ef7081e1539ac00ef5b761b4fb01b3:test/output-tests/test1.expected -# end context for test/output-tests/test1.expected - -# begin context for test/output-tests/test2.expected -# file test/output-tests/test2.expected -894dddf3304cbcb0fe04f7c2bbd56073:test/output-tests/test2.expected -# end context for test/output-tests/test2.expected - -# begin context for test/output-tests/test2.ml -# file test/output-tests/test2.ml -704ff05ffd8b0e50716542fa55b2db8a:test/output-tests/test2.ml -# end context for test/output-tests/test2.ml diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index bdd89be..1e3187a 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -1,5 +1,6 @@ name: Main Workflow +# use fields.git-main-branch to change from master on: pull_request: branches: @@ -16,62 +17,66 @@ jobs: os: - ubuntu-latest - macos-latest + - windows-latest ocaml-compiler: - - 4.10.0 + - 4.14.2 skip_test: - false include: - os: ubuntu-latest - ocaml-compiler: 4.07.0 + ocaml-compiler: 4.11.0 skip_test: true +# we need permissions to deploy docs + permissions: + contents: write + runs-on: ${{ matrix.os }} + # use fields.github-workflow-env to add something here + steps: - name: Checkout code uses: actions/checkout@v2 - name: Retrieve opam cache - uses: actions/cache@v2 + uses: actions/cache@v4 id: cache-opam with: path: ~/.opam - key: v2-${{ runner.os }}-ez_file-${{ matrix.ocaml-compiler }}-${{ hashFiles('opam/*.opam') }} + key: v4-${{ runner.os }}-ez_file-${{ matrix.ocaml-compiler }}-${{ hashFiles('opam/*.opam') }} # restore-keys: | -# v2-${{ runner.os }}-opam-${{ matrix.ocaml-compiler }}- +# v4-${{ runner.os }}-opam-${{ matrix.ocaml-compiler }}- - name: Use OCaml ${{ matrix.ocaml-compiler }} - uses: avsm/setup-ocaml@v2 + uses: avsm/setup-ocaml@v3 with: ocaml-compiler: ${{ matrix.ocaml-compiler }} opam-pin: false - opam-depext: false - name: Set git user run: | git config --global user.name github-actions git config --global user.email github-actions-bot@users.noreply.github.com - # define opam-repo = "git+https://" to add an extra opam repo + # use fields.opam-repo = "git+https://" to add an 'extra' opam repository - run: opam pin add . -y --no-action - - run: opam depext -y ez_file -# if: steps.cache-opam.outputs.cache-hit != 'true' - - - run: opam install -y opam/*.opam --deps-only --with-test -# if: steps.cache-opam.outputs.cache-hit != 'true' + - run: opam install -y ./opam/*.opam --deps-only --with-test -# - run: opam upgrade --fixup -# if: steps.cache-opam.outputs.cache-hit == 'true' - - - run: dos2unix scripts/*.sh + # Use fields.build-scripts to add more scripts to convert here + - run: dos2unix scripts/*.sh if: matrix.os == 'windows-latest' + # Use fields.github-workflow-before-build to add something here + - run: make build + # Use fields.github-workflow-after-build to add something here + - name: run test suite run: | ./scripts/before.sh test @@ -79,13 +84,15 @@ jobs: ./scripts/after.sh test if: matrix.skip_test != 'true' + # Use fields.github-workflow-after-test to add something here + - name: test source is well formatted run: make fmt continue-on-error: true - if: matrix.ocaml-compiler == '4.10.0' && matrix.os == 'ubuntu-latest' + if: matrix.ocaml-compiler == '4.14.2' && matrix.os == 'ubuntu-latest' - name: build-doc - if: github.ref == 'refs/heads/master' && matrix.ocaml-compiler == '4.10.0' && matrix.os == 'ubuntu-latest' + if: github.ref == 'refs/heads/master' && matrix.ocaml-compiler == '4.14.2' && matrix.os == 'ubuntu-latest' run: | sudo apt install -yqq python3-sphinx python3-sphinx-rtd-theme opam install -y dune odoc @@ -96,9 +103,12 @@ jobs: - name: deploy-doc uses: JamesIves/github-pages-deploy-action@3.6.2 - if: github.ref == 'refs/heads/master' && matrix.ocaml-compiler == '4.10.0' && matrix.os == 'ubuntu-latest' + if: github.ref == 'refs/heads/master' && matrix.ocaml-compiler == '4.14.2' && matrix.os == 'ubuntu-latest' with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} BRANCH: gh-pages FOLDER: _drom/docs/ CLEAN: true + +# Use fields.github-workflow-trailer to add a trailer here + diff --git a/.gitignore b/.gitignore index 6f62fd4..9bf1137 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ *~ _build .merlin -.vscode /_drom /_opam /_build diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..b582063 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "ocaml.sandbox": { + "kind": "opam" + "switch": "${workspaceFolder}" + } +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..6df6495 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,25 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "ocaml: dune build", + "type": "shell", + "command": "dune build", + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "ocaml: dune runtest -f", + "type": "shell", + "command": "dune runtest -f", + "group": { + "kind": "test", + "isDefault": true + } + } + ] +} diff --git a/Makefile b/Makefile index ab94d1a..4b05c04 100644 --- a/Makefile +++ b/Makefile @@ -1,88 +1,2 @@ -# Generated by "drom project" -.PHONY: all build build-deps fmt fmt-check install dev-deps test -.PHONY: clean distclean - -DEV_DEPS := merlin ocamlformat odoc ppx_expect ppx_inline_test - - -SPHINX_TARGET:=_drom/docs/sphinx - -ODOC_TARGET:=_drom/docs/doc/. - - -# Use these non-generated files to include more rules here (and -# Makefile.trailer at the end) --include Makefile.header --include Makefile.config - -all: build - -build: - ./scripts/before.sh build - opam exec -- dune build @install - ./scripts/copy-bin.sh ez_file - ./scripts/after.sh build - -build-deps: - if ! [ -e _opam ]; then \ - opam switch create . 4.10.0 ; \ - fi - opam install ./*.opam --deps-only - - -.PHONY: doc-common odoc view sphinx -doc-common: build - mkdir -p _drom/docs - rsync -auv docs/. _drom/docs/. - -sphinx: doc-common - ./scripts/before.sh sphinx ${SPHINX_TARGET} - sphinx-build sphinx ${SPHINX_TARGET} - ./scripts/after.sh sphinx ${SPHINX_TARGET} - -odoc: doc-common - mkdir -p ${ODOC_TARGET} - ./scripts/before.sh odoc ${ODOC_TARGET} - opam exec -- dune build @doc - rsync -auv --delete _build/default/_doc/_html/. ${ODOC_TARGET} - ./scripts/after.sh odoc ${ODOC_TARGET} - -doc: doc-common odoc sphinx - -view: - xdg-open file://$$(pwd)/_drom/docs/index.html - -fmt: - opam exec -- dune build @fmt --auto-promote - -fmt-check: - opam exec -- dune build @fmt - -install: - opam pin -y --no-action -k path . - opam install -y . - -opam: - opam pin -k path . - -uninstall: - opam uninstall . - -dev-deps: - opam install ./*.opam --deps-only --with-doc --with-test - -test: - ./scripts/before.sh test - opam exec -- dune build @runtest - ./scripts/after.sh test - -clean: - rm -rf _build - ./scripts/after.sh clean - -distclean: clean - rm -rf _opam _drom - ./scripts/after.sh distclean - --include Makefile.trailer +include Makefile.drom diff --git a/Makefile.drom b/Makefile.drom new file mode 100644 index 0000000..7214ecf --- /dev/null +++ b/Makefile.drom @@ -0,0 +1,83 @@ +# Maintained by "drom project" +.PHONY: $(DROMNS)build $(DROMNS)build-deps $(DROMNS)fmt $(DROMNS)fmt-check +.PHONY: $(DROMNS)install $(DROMNS)dev-deps $(DROMNS)test +.PHONY: $(DROMNS)clean $(DROMNS)distclean + +DROM_DEV_DEPS := merlin ocamlformat odoc ppx_expect ppx_inline_test $(DEV_DEPS) + + +SPHINX_TARGET:=_drom/docs/sphinx + +ODOC_TARGET:=_drom/docs/doc/. + + +$(DROMNS)build: + ./scripts/before.sh build + opam exec -- dune build @install + ./scripts/copy-bin.sh ez_file + ./scripts/after.sh build + +$(DROMNS)build-deps: + if ! [ -e _opam ]; then \ + opam switch create . 4.14.2 ; \ + fi + opam install ./opam/*.opam --deps-only + + +.PHONY: $(DROMNS)doc-common $(DROMNS)odoc $(DROMNS)view +.PHONY: $(DROMNS)sphinx +$(DROMNS)doc-common: $(DROMNS)build + mkdir -p _drom/docs + rsync -auv docs/. _drom/docs/. + +$(DROMNS)sphinx: $(DROMNS)doc-common + ./scripts/before.sh sphinx ${SPHINX_TARGET} + sphinx-build sphinx ${SPHINX_TARGET} + ./scripts/after.sh sphinx ${SPHINX_TARGET} + +$(DROMNS)odoc: $(DROMNS)doc-common + mkdir -p ${ODOC_TARGET} + ./scripts/before.sh odoc ${ODOC_TARGET} + opam exec -- dune build @doc + rsync -auv --delete _build/default/_doc/_html/. ${ODOC_TARGET} + ./scripts/after.sh odoc ${ODOC_TARGET} + +$(DROMNS)doc: $(DROMNS)doc-common $(DROMNS)odoc $(DROMNS)sphinx + +$(DROMNS)view: + xdg-open file://$$(pwd)/_drom/docs/index.html + +$(DROMNS)fmt: + opam exec -- dune build @fmt --auto-promote + +$(DROMNS)fmt-check: + opam exec -- dune build @fmt + +$(DROMNS)install: + opam pin -y --no-action -k path . + opam install -y . + +$(DROMNS)opam: + opam pin -k path . + +$(DROMNS)uninstall: + opam uninstall . + +$(DROMNS)dev-deps: + opam install ./opam/*.opam --deps-only --with-doc --with-test + +$(DROMNS)test: + ./scripts/before.sh test + opam exec -- dune build @runtest + ./scripts/after.sh test + +$(DROMNS)clean: + rm -rf _build + rm -f *.exe *~ + ./scripts/after.sh clean + +$(DROMNS)distclean: $(DROMNS)clean + rm -rf _opam _drom + ./scripts/after.sh distclean + + diff --git a/docs/index.html b/docs/index.html index eabcd46..a99b2d7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,7 +3,7 @@ ez_file - + @@ -27,6 +27,9 @@

ez_file

Authors:

+ +
+

diff --git a/drom.toml b/drom.toml index c88bf14..1b42bc6 100644 --- a/drom.toml +++ b/drom.toml @@ -1,18 +1,20 @@ [project] -drom-version = "0.1" +drom-version = "0.9.3" +share-repo = "https://github.com/OCamlPro/drom-share" +share-version = "0.9.3" [project] authors = ["Fabrice Le Fessant "] -ci-systems = ["ubuntu-latest", "macos-latest"] +ci-systems = ["ubuntu-latest", "macos-latest", "windows-latest"] copyright = "OCamlPro SAS" -edition = "4.10.0" +edition = "4.14.2" github-organization = "ocamlpro" license = "LGPL2" -min-edition = "4.07.0" +min-edition = "4.11.0" name = "ez_file" skeleton = "program" synopsis = "Easy file manipulation (read_file, write_file, etc.)" -version = "0.4.0" +version = "0.4.1" # keys that you could also define: # odoc-target = "...odoc-target..." @@ -31,22 +33,25 @@ and scan directories. """ [project] -skip = ["src/ez_file/main.ml", "CHANGES.md", "test/expect-tests/test.ml"] +skip = ["src/ez_file/main.ml", "CHANGES.md", + "test/expect-tests/test.ml", + "test/inline-tests/dune", "test/inline-tests/dune.drom", + "test/inline-tests/test.ml", + "test/output-tests/dune", "test/output-tests/dune.drom", + "test/output-tests/test1.expected", + "test/output-tests/test2.ml", + "test/output-tests/test2.expected"] # project-wide library dependencies (not for package-specific deps) [dependencies] # project-wide tools dependencies (not for package-specific deps) [tools] -dune = "2.6.0" -[tools.ocamlformat] -for-test = true +dune = "2.8" [tools.odoc] for-doc = true [tools.ppx_expect] for-test = true -[tools.ppx_inline_test] -for-test = true [project] @@ -73,6 +78,7 @@ share-dirs = ["share"] # readme-trailer = "..." # dot-gitignore-trailer = "..." [fields] +dune-lang = "2.8.0" # ... [[package]] diff --git a/dune-project b/dune-project index 2100e3b..d5f1dd1 100644 --- a/dune-project +++ b/dune-project @@ -3,9 +3,8 @@ (cram enable) (name ez_file) -(allow_approximate_merlin) (generate_opam_files false) -(version 0.4.0) +(version 0.4.1) (formatting (enabled_for ocaml reason)) (package @@ -13,17 +12,23 @@ (synopsis "Easy file manipulation (read_file, write_file, etc.)") (description "This library provides some modules to read and write files, and create \nand scan directories.\n") + (sites + + ) + (depends - (ocaml (>= 4.07.0)) + (ocaml (>= 4.11.0)) (re (and (>= 1.8.0) (< 2.0.0))) (ocplib_stuff (and (>= 0.1.0) (< 1.0.0))) (base-unix ( >= base )) - ppx_inline_test ppx_expect odoc - ocamlformat - (dune (and (>= 2.6.0) (< 3.0.0))) + (dune ( >= 2.8 )) ) ) + +; add this in dune-project-trailer if you need it, as it is not used +; by the most recent versions of dune +;(allow_approximate_merlin) diff --git a/opam/ez_file.opam b/opam/ez_file.opam index 3214b82..cd1fb6b 100644 --- a/opam/ez_file.opam +++ b/opam/ez_file.opam @@ -2,7 +2,7 @@ # Do not modify, or add to the `skip` field of `drom.toml`. opam-version: "2.0" name: "ez_file" -version: "0.4.0" +version: "0.4.1" license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception" synopsis: "Easy file manipulation (read_file, write_file, etc.)" description: """\ @@ -36,14 +36,13 @@ install: [ ["sh" "-c" "./scripts/before.sh install '%{name}%'"] ] depends: [ - "ocaml" {>= "4.07.0"} + "ocaml" {>= "4.11.0"} "dune" {>= "2.8.0"} "re" {>= "1.8.0" & < "2.0.0"} "ocplib_stuff" {>= "0.1.0" & < "1.0.0"} "base-unix" {>= "base"} - "ppx_inline_test" {with-test} "ppx_expect" {with-test} "odoc" {with-doc} - "ocamlformat" {with-test} - "dune" {>= "2.6.0" & < "3.0.0"} -] \ No newline at end of file + "dune" {>= "2.8"} +] +# Content of `opam-trailer` field: \ No newline at end of file diff --git a/scripts/copy-bin.sh b/scripts/copy-bin.sh index 096ef52..09b0317 100755 --- a/scripts/copy-bin.sh +++ b/scripts/copy-bin.sh @@ -5,6 +5,6 @@ PACKAGES="$*" for package in ${PACKAGES}; do file=_build/default/src/${package}/main.exe if [ -f ${file} ]; then - cp -f ${file} ${package} + cp -f ${file} ${package}.exe fi done diff --git a/scripts/static-build.sh b/scripts/static-build.sh new file mode 100755 index 0000000..000948d --- /dev/null +++ b/scripts/static-build.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -ue + +LC_ALL=C + +cd $(dirname "$0")/.. + +## Run build in container + +set -o pipefail + +# Use `docker-alpine-image` field to replace ocamlpro/ocaml:4.13 +# and `docker-alpine-packages` to add more apk packages +git ls-files -z | xargs -0 tar c | \ +docker run --rm -i \ + ocamlpro/ocaml:4.13 \ + sh -uexc \ + 'tar x >&2 && + sudo apk add g++ openssl-libs-static bash >&2 && + opam update >&2 && + opam switch create . ocaml-system --deps-only --locked >&2 && + opam exec make LINKING_MODE=static >&2 && + tar c -hC _build/install/default/bin .' | \ + tar vx + +# if you get: "this does not look like a tar archive", you might have forgotten +# a >&2 on a command (nothing should be printed on stdout, except the tar file) diff --git a/sphinx/install.rst b/sphinx/install.rst index 598d339..8399850 100644 --- a/sphinx/install.rst +++ b/sphinx/install.rst @@ -13,10 +13,10 @@ Build and install with :code:`dune` Checkout the sources of :code:`ez_file` in a directory. -You need a switch with at least version :code:`4.07.0` of OCaml, +You need a switch with at least version :code:`4.12.0` of OCaml, you can for example create it with:: - opam switch create 4.10.0 + opam switch create 4.12.0 Then, you need to install all the dependencies:: diff --git a/src/ez_file/dune b/src/ez_file/dune index 9b69be4..2f96064 100644 --- a/src/ez_file/dune +++ b/src/ez_file/dune @@ -4,7 +4,11 @@ (name ez_file) (public_name ez_file) (wrapped true) + ; use field 'dune-libraries' to add libraries without opam deps (libraries re ocplib_stuff unix ) + ; use field 'dune-flags' to set this value + (flags (:standard)) + ; use field 'dune-stanzas' to add more stanzas here ) @@ -13,4 +17,5 @@ (documentation (package ez_file)) +; use field 'dune-trailer' to add more stuff here diff --git a/src/ez_file/package.toml b/src/ez_file/package.toml index f0321f7..986a6a4 100644 --- a/src/ez_file/package.toml +++ b/src/ez_file/package.toml @@ -39,7 +39,7 @@ kind = "library" # optional = true # module name used to pack modules (if pack-modules is true) -# pack = "EzFile" +# pack = "Mylib" # preprocessing options # preprocess = "per-module (((action (run ./toto.sh %{input-file})) mod))" diff --git a/test/expect-tests/dune b/test/expect-tests/dune index 7f31223..ce09bdd 100644 --- a/test/expect-tests/dune +++ b/test/expect-tests/dune @@ -1,10 +1 @@ -; if you modify this file, add 'test' to the 'skip' field in drom.toml - -(library - (name lib_expect_tests) - (preprocess - (pps ppx_expect)) - (inline_tests - (modes best)) ; add js for testing with nodejs - (libraries ez_file) ; add your project libraries here - ) +(include dune.drom) diff --git a/test/expect-tests/dune.drom b/test/expect-tests/dune.drom new file mode 100644 index 0000000..536d09b --- /dev/null +++ b/test/expect-tests/dune.drom @@ -0,0 +1,14 @@ +; This file is managed by 'drom project' + +; You may want to remove it by adding 'test/expect-tests/dune.drom' +; to 'skip' in 'drom.toml', or '@test' for all tests +; and remove the '(include dune.drom)' from 'dune' in the current dir + +(library + (name lib_expect_tests) + (preprocess + (pps ppx_expect)) + (inline_tests + (modes best)) ; add js for testing with nodejs + (libraries ez_file) ; add your project libraries here + ) diff --git a/test/inline-tests/dune b/test/inline-tests/dune deleted file mode 100644 index b9bf212..0000000 --- a/test/inline-tests/dune +++ /dev/null @@ -1,9 +0,0 @@ -; if you modify this file, add 'test' to the 'skip' field in drom.toml - -(library - (name lib_inline_tests) - (preprocess - (pps ppx_inline_test)) - (inline_tests - (modes best)) ; add js for testing with nodejs - (libraries ez_file)) diff --git a/test/inline-tests/test.ml b/test/inline-tests/test.ml deleted file mode 100644 index cab8a3d..0000000 --- a/test/inline-tests/test.ml +++ /dev/null @@ -1,8 +0,0 @@ -let%test "must-return-true" = true - -let%test_unit "must-return-unit" = () - -let%test_module "module" = - ( module struct - let%test "must-return-true" = true - end ) diff --git a/test/output-tests/dune b/test/output-tests/dune deleted file mode 100644 index 4821e68..0000000 --- a/test/output-tests/dune +++ /dev/null @@ -1,37 +0,0 @@ -; if you modify this file, add 'test' to the 'skip' field in drom.toml - -; a first example where we would test the behavior of one of the executables -; that we generate else-where - -(rule - (deps test1.expected) - (action - (with-stdout-to - test1.output - (run cat test1.expected)))) - -(rule - (alias runtest) - (action - (diff test1.expected test1.output))) - -; a second example where we generate a file and test its output - -(executable - (name test2) - (libraries ez_file) ; add your own library here - ) - -(alias - (name buildtest) - (deps test2.exe)) - -(rule - (with-stdout-to - test2.output - (run %{exe:test2.exe}))) - -(rule - (alias runtest) - (action - (diff test2.expected test2.output))) diff --git a/test/output-tests/test1.expected b/test/output-tests/test1.expected deleted file mode 100644 index 802992c..0000000 --- a/test/output-tests/test1.expected +++ /dev/null @@ -1 +0,0 @@ -Hello world diff --git a/test/output-tests/test2.expected b/test/output-tests/test2.expected deleted file mode 100644 index 632e4fe..0000000 --- a/test/output-tests/test2.expected +++ /dev/null @@ -1 +0,0 @@ -Bonjour diff --git a/test/output-tests/test2.ml b/test/output-tests/test2.ml deleted file mode 100644 index 31422a4..0000000 --- a/test/output-tests/test2.ml +++ /dev/null @@ -1,3 +0,0 @@ -let () = - Printf.printf "Bonjour\n%!"; - exit 0