From 73a47531366d54ca98f659ab7b97445d74025f9d Mon Sep 17 00:00:00 2001 From: Sora Morimoto Date: Tue, 19 Nov 2024 05:46:15 +0900 Subject: [PATCH] Cleanup Signed-off-by: Sora Morimoto --- .github/workflows/workflow.yml | 54 +------- docs/dune | 2 +- dune-project | 8 +- lwt.opam | 1 + lwt_ppx.opam | 1 + lwt_react.opam | 1 + lwt_retry.opam | 6 +- src/core/dune | 16 +-- src/ppx/dune | 20 +-- src/react/dune | 16 +-- src/retry/dune | 16 +-- src/unix/dune | 221 ++++++++++----------------------- test/core/dune | 4 +- test/ppx/dune | 4 +- test/ppx/main.ml | 2 + test/ppx_let/dune | 3 +- test/unix/dune | 16 +-- 17 files changed, 104 insertions(+), 287 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index ff1e49e194..5ea1787d8d 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -28,51 +28,16 @@ jobs: libev: - true - false - ppx: - - true - local-packages: - - | - *.opam include: - os: ubuntu-latest ocaml-compiler: ocaml-variants.5.2.0+options,ocaml-option-flambda,ocaml-option-musl,ocaml-option-static,ocaml-option-no-compression - libev: false - ppx: true - local-packages: | - *.opam - - os: macos-latest - ocaml-compiler: "5.2" libev: true - ppx: true - local-packages: | - *.opam - - os: windows-latest - ocaml-compiler: "5.2" - libev: false - ppx: true - local-packages: | - *.opam - - os: ubuntu-latest - ocaml-compiler: "5.2" - libev: true - ppx: false - local-packages: | - *.opam - !lwt_ppx.opam - os: macos-latest ocaml-compiler: "5.2" libev: true - ppx: false - local-packages: | - *.opam - !lwt_ppx.opam - os: windows-latest ocaml-compiler: "5.2" libev: false - ppx: false - local-packages: | - *.opam - !lwt_ppx.opam runs-on: ${{ matrix.os }} @@ -84,37 +49,26 @@ jobs: uses: ocaml/setup-ocaml@v3 with: ocaml-compiler: ${{ matrix.ocaml-compiler }} - opam-local-packages: ${{ matrix.local-packages }} - run: opam install conf-libev if: ${{ matrix.libev == true }} - - run: opam install lwt_react lwt --deps-only --with-test - - - run: opam install lwt_ppx --deps-only --with-test - if: ${{ matrix.ppx == true }} - - - run: opam exec -- dune build --only-packages lwt_react,lwt + - run: opam install . --deps-only --with-test - - run: opam exec -- dune build --only-packages lwt_ppx - if: ${{ matrix.ppx == true }} + - run: opam exec -- dune build - - run: opam exec -- dune runtest --only-packages lwt_react,lwt + - run: opam exec -- dune runtest --instrument-with bisect_ppx --force - - run: opam exec -- dune runtest --only-packages lwt_ppx - if: ${{ matrix.ppx == true }} + - run: opam exec -- bisect-ppx-report summary --per-file lint-opam: runs-on: ubuntu-latest - steps: - name: Checkout tree uses: actions/checkout@v4 - - name: Set-up OCaml uses: ocaml/setup-ocaml@v3 with: ocaml-compiler: "5.2" dune-cache: true - - uses: ocaml/setup-ocaml/lint-opam@v3 diff --git a/docs/dune b/docs/dune index cb49e843ee..380ec02289 100644 --- a/docs/dune +++ b/docs/dune @@ -1,3 +1,3 @@ (documentation (package lwt) - (mld_files :standard)) + (mld_files :standard)) diff --git a/dune-project b/dune-project index b233ce5e1c..5c32ef3df4 100644 --- a/dune-project +++ b/dune-project @@ -21,7 +21,8 @@ "Shon Feder ") (depends (ocaml (>= 4.08)) - (lwt (>= 5.3.0)))) + (lwt (>= 5.3.0)) + (bisect_ppx :with-test))) (package (name lwt_ppx) @@ -30,6 +31,7 @@ (ocaml (>= 4.08)) (ppxlib (>= 0.16.0)) (ppx_let :with-test) + (bisect_ppx :with-test) lwt)) (package @@ -39,7 +41,8 @@ (ocaml (>= 4.08)) (cppo (and :build (>= 1.1.0))) (lwt (>= 3.0.0)) - (react (>= 1.0.0)))) + (react (>= 1.0.0)) + (bisect_ppx :with-test))) (package (name lwt) @@ -58,6 +61,7 @@ synchronization primitives. Code can be run in parallel on an opt-in basis. (cppo (and :build (>= 1.1.0))) (ocamlfind (and :dev (>= 1.7.3-1))) (odoc (and :with-doc (>= 2.3.0))) + (bisect_ppx :with-test) dune-configurator ocplib-endian) (depopts base-threads base-unix conf-libev)) diff --git a/lwt.opam b/lwt.opam index bc59b1d1e0..93a3ed64cb 100644 --- a/lwt.opam +++ b/lwt.opam @@ -25,6 +25,7 @@ depends: [ "cppo" {build & >= "1.1.0"} "ocamlfind" {dev & >= "1.7.3-1"} "odoc" {with-doc & >= "2.3.0"} + "bisect_ppx" {with-test} "dune-configurator" "ocplib-endian" ] diff --git a/lwt_ppx.opam b/lwt_ppx.opam index 68b2faf99d..57b2c210f5 100644 --- a/lwt_ppx.opam +++ b/lwt_ppx.opam @@ -15,6 +15,7 @@ depends: [ "ocaml" {>= "4.08"} "ppxlib" {>= "0.16.0"} "ppx_let" {with-test} + "bisect_ppx" {with-test} "lwt" "odoc" {with-doc} ] diff --git a/lwt_react.opam b/lwt_react.opam index 975424697c..c506050bdd 100644 --- a/lwt_react.opam +++ b/lwt_react.opam @@ -15,6 +15,7 @@ depends: [ "cppo" {build & >= "1.1.0"} "lwt" {>= "3.0.0"} "react" {>= "1.0.0"} + "bisect_ppx" {with-test} "odoc" {with-doc} ] build: [ diff --git a/lwt_retry.opam b/lwt_retry.opam index bf8413e56f..879deec73e 100644 --- a/lwt_retry.opam +++ b/lwt_retry.opam @@ -10,12 +10,14 @@ homepage: "https://github.com/ocsigen/lwt" doc: "https://ocsigen.org/lwt" bug-reports: "https://github.com/ocsigen/lwt/issues" depends: [ - "dune" {>= "2.0"} + "dune" {>= "2.7"} "ocaml" {>= "4.08"} "lwt" {>= "5.3.0"} + "bisect_ppx" {with-test} + "odoc" {with-doc} ] build: [ - ["dune" "subst"] {pinned} + ["dune" "subst"] {dev} [ "dune" "build" diff --git a/src/core/dune b/src/core/dune index 9b890d1855..dab7ccc8db 100644 --- a/src/core/dune +++ b/src/core/dune @@ -1,21 +1,9 @@ -(* -*- tuareg -*- *) - -let preprocess = - match Sys.getenv "BISECT_ENABLE" with - | "yes" -> "(preprocess (pps bisect_ppx))" - | _ -> "" - | exception _ -> "" - -let () = Jbuild_plugin.V1.send @@ {| - (library (public_name lwt) (synopsis "Monadic promises and concurrent I/O") (wrapped false) - |} ^ preprocess ^ {| - (flags (:standard -w +A-29))) + (instrumentation + (backend bisect_ppx))) (documentation (package lwt)) - -|} diff --git a/src/ppx/dune b/src/ppx/dune index 34f7513dd3..1a48fc9380 100644 --- a/src/ppx/dune +++ b/src/ppx/dune @@ -1,22 +1,10 @@ -(* -*- tuareg -*- *) - -let bisect_ppx = - match Sys.getenv "BISECT_ENABLE" with - | "yes" -> "bisect_ppx" - | _ -> "" - | exception _ -> "" - -let () = Jbuild_plugin.V1.send @@ {| - (library - (name ppx_lwt) (public_name lwt_ppx) (synopsis "Lwt PPX syntax extension") - (modules ppx_lwt) (libraries ppxlib) (ppx_runtime_libraries lwt) (kind ppx_rewriter) - (preprocess (pps ppxlib.metaquot|} ^ bisect_ppx ^ {|)) - (flags (:standard -w +A-4))) - -|} + (preprocess + (pps ppxlib.metaquot)) + (instrumentation + (backend bisect_ppx))) diff --git a/src/react/dune b/src/react/dune index 116f8454e5..be26a6c340 100644 --- a/src/react/dune +++ b/src/react/dune @@ -1,19 +1,7 @@ -(* -*- tuareg -*- *) - -let preprocess = - match Sys.getenv "BISECT_ENABLE" with - | "yes" -> "(preprocess (pps bisect_ppx))" - | _ -> "" - | exception _ -> "" - -let () = Jbuild_plugin.V1.send @@ {| - (library (public_name lwt_react) (synopsis "Reactive programming helpers for Lwt") (wrapped false) (libraries lwt react) - |} ^ preprocess ^ {| - (flags (:standard -w +A))) - -|} + (instrumentation + (backend bisect_ppx))) diff --git a/src/retry/dune b/src/retry/dune index 2a09d3d6e5..0dd136a478 100644 --- a/src/retry/dune +++ b/src/retry/dune @@ -1,19 +1,7 @@ -(* -*- tuareg -*- *) - -let preprocess = - match Sys.getenv "BISECT_ENABLE" with - | "yes" -> "(preprocess (pps bisect_ppx))" - | _ -> "" - | exception _ -> "" - -let () = Jbuild_plugin.V1.send @@ {| - (library (public_name lwt_retry) (synopsis "A utility for retrying Lwt computations") (wrapped false) (libraries lwt lwt.unix) - |} ^ preprocess ^ {| - (flags (:standard -w +A))) - -|} + (instrumentation + (backend bisect_ppx))) diff --git a/src/unix/dune b/src/unix/dune index 830eb256af..3f146ee5c2 100644 --- a/src/unix/dune +++ b/src/unix/dune @@ -1,189 +1,98 @@ -(* -*- tuareg -*- *) - -let preprocess = - match Sys.getenv "BISECT_ENABLE" with - | "yes" -> "(preprocess (pps bisect_ppx))" - | _ -> "" - | exception _ -> "" - -let () = Jbuild_plugin.V1.send @@ {| - (rule (targets lwt_process.ml) - (deps (:ml lwt_process.cppo.ml)) + (deps + (:ml lwt_process.cppo.ml)) (action - (chdir %{project_root} + (chdir + %{project_root} (run %{bin:cppo} -V OCAML:%{ocaml_version} %{ml} -o %{targets})))) (rule (targets lwt_unix.ml) - (deps (:ml lwt_unix.cppo.ml)) + (deps + (:ml lwt_unix.cppo.ml)) (action - (chdir %{project_root} + (chdir + %{project_root} (run %{bin:cppo} -V OCAML:%{ocaml_version} %{ml} -o %{targets})))) (rule (targets lwt_unix.mli) - (deps (:ml lwt_unix.cppo.mli)) + (deps + (:ml lwt_unix.cppo.mli)) (action - (chdir %{project_root} + (chdir + %{project_root} (run %{bin:cppo} -V OCAML:%{ocaml_version} %{ml} -o %{targets})))) (rule (mode fallback) (targets discover_arguments) - (action (with-stdout-to %{targets} (echo "")))) + (action + (with-stdout-to + %{targets} + (echo "")))) (rule - (targets - unix_c_flags.sexp unix_c_library_flags.sexp lwt_features.h lwt_features.ml) - (deps (:exe config/discover.exe) discover_arguments) - (action (run %{exe}))) + (targets unix_c_flags.sexp unix_c_library_flags.sexp lwt_features.h + lwt_features.ml) + (deps + (:exe config/discover.exe) + discover_arguments) + (action + (run %{exe}))) (copy_files unix_c/*) + (copy_files windows_c/*.c) (library (name lwt_unix) (public_name lwt.unix) (synopsis "Unix support for Lwt") - (optional) (wrapped false) (libraries bigarray lwt ocplib-endian.bigstring threads unix) - |} ^ preprocess ^ {| (install_c_headers lwt_features lwt_config lwt_unix) (foreign_stubs - (language c) - (names - lwt_unix_stubs - lwt_libev_stubs - lwt_process_stubs - unix_readable - unix_writable - unix_madvise - unix_get_page_size - windows_get_page_size - unix_mincore - unix_read - unix_pread - windows_read - windows_pread - unix_bytes_read - windows_bytes_read - unix_write - unix_pwrite - windows_write - windows_pwrite - unix_bytes_write - windows_bytes_write - unix_readv_writev_utils - unix_iov_max - unix_writev - unix_writev_job - unix_readv - unix_readv_job - unix_send - unix_bytes_send - unix_recv - unix_bytes_recv - unix_recvfrom - unix_bytes_recvfrom - unix_sendto - unix_sendto_byte - unix_bytes_sendto - unix_bytes_sendto_byte - unix_recv_send_utils - unix_recv_msg - unix_send_msg - unix_send_msg_byte - unix_get_credentials - unix_mcast_utils - unix_mcast_set_loop - unix_mcast_set_ttl - unix_mcast_modify_membership - unix_wait4 - unix_get_cpu - unix_get_affinity - unix_set_affinity - unix_guess_blocking_job - unix_wait_mincore_job - unix_open_job - unix_read_job - unix_pread_job - windows_read_job - windows_pread_job - unix_bytes_read_job - windows_bytes_read_job - unix_write_job - windows_write_job - unix_pwrite_job - windows_pwrite_job - unix_bytes_write_job - windows_bytes_write_job - unix_stat_job_utils - unix_stat_job - unix_stat_64_job - unix_lstat_job - unix_lstat_64_job - unix_fstat_job - unix_fstat_64_job - unix_utimes_job - unix_isatty_job - unix_opendir_job - unix_closedir_job - unix_valid_dir - unix_invalidate_dir - unix_rewinddir_job - unix_readdir_job - unix_readdir_n_job - unix_readlink_job - unix_lockf_job - unix_getlogin_job - unix_get_pw_gr_nam_id_job - unix_get_network_information_utils - unix_gethostname_job - unix_gethostbyname_job - unix_gethostbyaddr_job - unix_getprotoby_getservby_job - unix_getaddrinfo_job - unix_getnameinfo_job - unix_bind_job - unix_getcwd_job - unix_termios_conversion - unix_tcgetattr_job - unix_tcsetattr_job - windows_is_socket - windows_fsync_job - windows_system_job - windows_not_available - unix_not_available - unix_access_job - unix_chdir_job - unix_chmod_job - unix_chown_job - unix_chroot_job - unix_close_job - unix_fchmod_job - unix_fchown_job - unix_fdatasync_job - unix_fsync_job - unix_ftruncate_job - unix_link_job - unix_lseek_job - unix_mkdir_job - unix_mkfifo_job - unix_rename_job - unix_rmdir_job - unix_symlink_job - unix_tcdrain_job - unix_tcflow_job - unix_tcflush_job - unix_tcsendbreak_job - unix_truncate_job - unix_unlink_job - unix_somaxconn - windows_somaxconn + (language c) + (names lwt_unix_stubs lwt_libev_stubs lwt_process_stubs unix_readable + unix_writable unix_madvise unix_get_page_size windows_get_page_size + unix_mincore unix_read unix_pread windows_read windows_pread + unix_bytes_read windows_bytes_read unix_write unix_pwrite windows_write + windows_pwrite unix_bytes_write windows_bytes_write + unix_readv_writev_utils unix_iov_max unix_writev unix_writev_job + unix_readv unix_readv_job unix_send unix_bytes_send unix_recv + unix_bytes_recv unix_recvfrom unix_bytes_recvfrom unix_sendto + unix_sendto_byte unix_bytes_sendto unix_bytes_sendto_byte + unix_recv_send_utils unix_recv_msg unix_send_msg unix_send_msg_byte + unix_get_credentials unix_mcast_utils unix_mcast_set_loop + unix_mcast_set_ttl unix_mcast_modify_membership unix_wait4 unix_get_cpu + unix_get_affinity unix_set_affinity unix_guess_blocking_job + unix_wait_mincore_job unix_open_job unix_read_job unix_pread_job + windows_read_job windows_pread_job unix_bytes_read_job + windows_bytes_read_job unix_write_job windows_write_job unix_pwrite_job + windows_pwrite_job unix_bytes_write_job windows_bytes_write_job + unix_stat_job_utils unix_stat_job unix_stat_64_job unix_lstat_job + unix_lstat_64_job unix_fstat_job unix_fstat_64_job unix_utimes_job + unix_isatty_job unix_opendir_job unix_closedir_job unix_valid_dir + unix_invalidate_dir unix_rewinddir_job unix_readdir_job + unix_readdir_n_job unix_readlink_job unix_lockf_job unix_getlogin_job + unix_get_pw_gr_nam_id_job unix_get_network_information_utils + unix_gethostname_job unix_gethostbyname_job unix_gethostbyaddr_job + unix_getprotoby_getservby_job unix_getaddrinfo_job unix_getnameinfo_job + unix_bind_job unix_getcwd_job unix_termios_conversion unix_tcgetattr_job + unix_tcsetattr_job windows_is_socket windows_fsync_job windows_system_job + windows_not_available unix_not_available unix_access_job unix_chdir_job + unix_chmod_job unix_chown_job unix_chroot_job unix_close_job + unix_fchmod_job unix_fchown_job unix_fdatasync_job unix_fsync_job + unix_ftruncate_job unix_link_job unix_lseek_job unix_mkdir_job + unix_mkfifo_job unix_rename_job unix_rmdir_job unix_symlink_job + unix_tcdrain_job unix_tcflow_job unix_tcflush_job unix_tcsendbreak_job + unix_truncate_job unix_unlink_job unix_somaxconn windows_somaxconn unix_accept4) - (flags (:include unix_c_flags.sexp))) - (c_library_flags (:include unix_c_library_flags.sexp))) -|} + (flags + (:include unix_c_flags.sexp))) + (c_library_flags + (:include unix_c_library_flags.sexp)) + (instrumentation + (backend bisect_ppx))) diff --git a/test/core/dune b/test/core/dune index b03d5ef183..1a3c883ab3 100644 --- a/test/core/dune +++ b/test/core/dune @@ -1,6 +1,4 @@ (test (name main) (package lwt) - (libraries lwttester) - (preprocess (future_syntax)) - (flags (:standard -w +A-40-42))) + (libraries lwttester)) diff --git a/test/ppx/dune b/test/ppx/dune index 30d4d19573..227d21f279 100644 --- a/test/ppx/dune +++ b/test/ppx/dune @@ -2,5 +2,5 @@ (name main) (package lwt_ppx) (libraries lwttester) - (preprocess (pps lwt_ppx)) - (flags (:standard -warn-error -22))) + (preprocess + (pps lwt_ppx))) diff --git a/test/ppx/main.ml b/test/ppx/main.ml index aa12da2513..ff9e5ca6fd 100644 --- a/test/ppx/main.ml +++ b/test/ppx/main.ml @@ -1,3 +1,5 @@ +[@@@ocaml.warning "-22"] + open Test open Lwt diff --git a/test/ppx_let/dune b/test/ppx_let/dune index 87529263bf..7915e092a3 100644 --- a/test/ppx_let/dune +++ b/test/ppx_let/dune @@ -1,5 +1,6 @@ (test (name test) (package lwt_ppx) ;; technically not part of lwt_ppx, but we want it tested and the dependency to ppxlib is already there - (preprocess (pps ppx_let)) + (preprocess + (pps ppx_let)) (libraries lwt lwt.unix)) diff --git a/test/unix/dune b/test/unix/dune index 9dc1df6431..21bed37e0b 100644 --- a/test/unix/dune +++ b/test/unix/dune @@ -2,16 +2,9 @@ (name tester) (libraries lwt lwttester) (modules - (:standard - \ - main - dummy - ocaml_runtime_exc_1 - ocaml_runtime_exc_2 - ocaml_runtime_exc_3 - ocaml_runtime_exc_4 - ocaml_runtime_exc_5 - ocaml_runtime_exc_6))) + (:standard \ main dummy ocaml_runtime_exc_1 ocaml_runtime_exc_2 + ocaml_runtime_exc_3 ocaml_runtime_exc_4 ocaml_runtime_exc_5 + ocaml_runtime_exc_6))) (executable (name dummy) @@ -23,8 +16,7 @@ (package lwt) (libraries lwttester tester) (modules main) - (deps bytes_io_data %{exe:dummy.exe}) -) + (deps bytes_io_data %{exe:dummy.exe})) (test (name ocaml_runtime_exc_1)