Repository: ocsigen/lwt
Pull request #614 (2018-08-26 21:56:12)

Convert from Jbuilder to Dune


Patch:
diff --git a/Makefile b/Makefile
index 239aa58a9..17fb7cefa 100644
--- a/Makefile
+++ b/Makefile
@@ -5,12 +5,12 @@ default: build
 # build the usual development packages
 .PHONY: build
 build: check-config
-	jbuilder build --dev
+	dune build
 
 # run unit tests for package lwt
 .PHONY: test
 test: build
-	jbuilder runtest --dev -j 1 --no-buffer
+	dune runtest -j 1 --no-buffer
 
 # configuration
 .PHONY: check-config
@@ -30,18 +30,18 @@ dev-deps :
 	opam install --yes --unset-root \
 	  bisect_ppx \
 	  cppo \
-	  jbuilder \
+	  dune \
 	  ocaml-migrate-parsetree \
 	  ocamlfind \
 	  ppx_tools_versioned \
 	  react \
 	  result \
 
-# Use jbuilder/odoc to generate static html documentation.
+# Use Dune+odoc to generate static html documentation.
 # Currenty requires ocaml 4.03.0 to install odoc.
 .PHONY: doc
 doc:
-	jbuilder build @doc
+	dune build @doc
 
 # Build HTML documentation with ocamldoc
 .PHONY: doc-api-html
@@ -76,7 +76,7 @@ install-for-packaging-test: clean
 
 .PHONY: clean
 clean:
-	jbuilder clean
+	dune clean
 	find . -name '.merlin' | xargs rm -f
 	rm -fr docs/api
 	rm -f src/jbuild-ignore src/unix/lwt_config src/core/flambda.flag
@@ -91,7 +91,7 @@ BISECT_FILES_PATTERN := _build/default/test/*/bisect*.out
 .PHONY: coverage
 coverage: clean check-config
 	BISECT_ENABLE=yes make build
-	BISECT_ENABLE=yes jbuilder runtest --dev -j 1 --no-buffer
+	BISECT_ENABLE=yes dune runtest -j 1 --no-buffer
 	bisect-ppx-report \
 	    -I _build/default/ -html _coverage/ \
 	    -text - -summary-only \
diff --git a/dune-project b/dune-project
new file mode 100644
index 000000000..7655de077
--- /dev/null
+++ b/dune-project
@@ -0,0 +1,1 @@
+(lang dune 1.1)
diff --git a/lwt.opam b/lwt.opam
index 49f958454..19fac19c9 100644
--- a/lwt.opam
+++ b/lwt.opam
@@ -17,7 +17,7 @@ dev-repo: "https://github.com/ocsigen/lwt.git"
 
 build: [
   [ "ocaml" "src/util/configure.ml" "-use-libev" "%{conf-libev:installed}%" ]
-  [ "jbuilder" "build" "-p" name "-j" jobs ]
+  [ "dune" "build" "-p" name "-j" jobs ]
 ]
 
 depends: [
@@ -25,15 +25,14 @@ depends: [
   # removed when preparing a release.
   "bisect_ppx" {>= "1.3.0"}
   "cppo" {build & >= "1.1.0"}
-  "jbuilder" {build & >= "1.0+beta14"}
+  "dune" {build}
   # We are only using ocamlfind during configuration of the Unix binding.
   # However, ocamlfind also installs the "threads" package, and ocamlfind
   # 1.7.3-1 is the first one whose threads package does not have incorrect error
   # lines. See
   #   https://github.com/ocaml/opam-repository/pull/11071#issuecomment-353131128
   # If ocamlfind becomes no longer necessary for configuration of Lwt, this
-  # dependency should be converted to a conflict, and package jbuilder should be
-  # constrained such that it also includes the error lines fix.
+  # dependency should be converted to a conflict.
   "ocamlfind" {build & >= "1.7.3-1"}
   # result is needed as long as Lwt still supports OCaml 4.02.
   "result"
@@ -44,5 +43,5 @@ depopts: [
   "conf-libev"
 ]
 # In practice, Lwt requires OCaml >= 4.02.3, as that is a constraint of the
-# dependency jbuilder.
+# dependency Dune.
 available: [ocaml-version >= "4.02.0" & compiler != "4.02.1+BER"]
diff --git a/lwt_ppx.opam b/lwt_ppx.opam
index f6facb238..a5d042ac4 100644
--- a/lwt_ppx.opam
+++ b/lwt_ppx.opam
@@ -13,7 +13,7 @@ bug-reports: "https://github.com/ocsigen/lwt/issues"
 license: "MIT"
 
 depends: [
-  "jbuilder" {build & >= "1.0+beta14"}
+  "dune" {build}
   "lwt"
   "ocaml-migrate-parsetree"
   "ppx_tools_versioned" {>= "5.0.1"}
@@ -24,5 +24,5 @@ depends: [
 available: [ocaml-version >= "4.02.0"]
 
 build: [
-  ["jbuilder" "build" "-p" name "-j" jobs]
+  ["dune" "build" "-p" name "-j" jobs]
 ]
diff --git a/lwt_react.opam b/lwt_react.opam
index 97815e991..6ec3e7c46 100644
--- a/lwt_react.opam
+++ b/lwt_react.opam
@@ -14,11 +14,11 @@ dev-repo: "https://github.com/ocsigen/lwt.git"
 bug-reports: "https://github.com/ocsigen/lwt/issues"
 license: "MIT"
 
-build: [ [ "jbuilder" "build" "-p" name "-j" jobs ] ]
-build-test: [ [ "jbuilder" "runtest" "-p" name ] ]
+build: [ [ "dune" "build" "-p" name "-j" jobs ] ]
+build-test: [ [ "dune" "runtest" "-p" name ] ]
 
 depends: [
-  "jbuilder" {build & >= "1.0+beta14"}
+  "dune" {build}
   "lwt" {>= "3.0.0"}
   "react" {>= "1.0.0"}
 ]
diff --git a/src/core/dune b/src/core/dune
new file mode 100644
index 000000000..f976b67ed
--- /dev/null
+++ b/src/core/dune
@@ -0,0 +1,9 @@
+(library
+ (name lwt)
+ (public_name lwt)
+ (synopsis "Monadic promises and concurrent I/O")
+ (wrapped false)
+ (preprocess (pps bisect_ppx -conditional))
+ (ocamlopt_flags (:standard (:include flambda.flag)))
+ (libraries bytes result)
+ (flags (:standard -w +A-29)))
diff --git a/src/core/jbuild b/src/core/jbuild
deleted file mode 100644
index 1af627fe9..000000000
--- a/src/core/jbuild
+++ /dev/null
@@ -1,11 +0,0 @@
-(jbuild_version 1)
-
-(library
- ((name lwt)
-  (public_name lwt)
-  (synopsis "Monadic promises and concurrent I/O")
-  (wrapped false)
-  (preprocess (pps (bisect_ppx -conditional)))
-  (ocamlopt_flags (:standard (:include flambda.flag)))
-  (libraries (bytes result))
-  (flags (:standard -w +A-29))))
diff --git a/src/ppx/dune b/src/ppx/dune
new file mode 100644
index 000000000..a45d2c51a
--- /dev/null
+++ b/src/ppx/dune
@@ -0,0 +1,10 @@
+(library
+ (name ppx_lwt)
+ (public_name lwt_ppx)
+ (synopsis "Lwt PPX syntax extension")
+ (modules ppx_lwt)
+ (libraries compiler-libs.common ocaml-migrate-parsetree ppx_tools_versioned)
+ (ppx_runtime_libraries lwt)
+ (kind ppx_rewriter)
+ (preprocess (pps ppx_tools_versioned.metaquot_404))
+ (flags (:standard -w +A-4)))
diff --git a/src/ppx/jbuild b/src/ppx/jbuild
deleted file mode 100644
index 5092b1192..000000000
--- a/src/ppx/jbuild
+++ /dev/null
@@ -1,14 +0,0 @@
-(jbuild_version 1)
-
-(library
- ((name ppx_lwt)
-  (public_name lwt_ppx)
-  (synopsis "Lwt PPX syntax extension")
-  (modules (ppx_lwt))
-  (libraries (compiler-libs.common
-              ocaml-migrate-parsetree
-              ppx_tools_versioned))
-  (ppx_runtime_libraries (lwt))
-  (kind ppx_rewriter)
-  (preprocess (pps (ppx_tools_versioned.metaquot_404)))
-  (flags (:standard -w +A-4))))
diff --git a/src/react/dune b/src/react/dune
new file mode 100644
index 000000000..f4717994b
--- /dev/null
+++ b/src/react/dune
@@ -0,0 +1,8 @@
+(library
+ (name lwt_react)
+ (public_name lwt_react)
+ (synopsis "Reactive programming helpers for Lwt")
+ (wrapped false)
+ (libraries lwt react)
+ (preprocess (pps bisect_ppx -conditional))
+ (flags (:standard -w +A)))
diff --git a/src/react/jbuild b/src/react/jbuild
deleted file mode 100644
index 23944cdf9..000000000
--- a/src/react/jbuild
+++ /dev/null
@@ -1,10 +0,0 @@
-(jbuild_version 1)
-
-(library
- ((name lwt_react)
-  (public_name lwt_react)
-  (synopsis "Reactive programming helpers for Lwt")
-  (wrapped false)
-  (libraries (lwt react))
-  (preprocess (pps (bisect_ppx -conditional)))
-  (flags (:standard -w +A))))
diff --git a/src/unix/config/dune b/src/unix/config/dune
new file mode 100644
index 000000000..3ebcfa693
--- /dev/null
+++ b/src/unix/config/dune
@@ -0,0 +1,3 @@
+(executable
+ (name discover)
+ (flags (:standard -w +A-29)))
diff --git a/src/unix/config/jbuild b/src/unix/config/jbuild
deleted file mode 100644
index 45e0e2988..000000000
--- a/src/unix/config/jbuild
+++ /dev/null
@@ -1,5 +0,0 @@
-(jbuild_version 1)
-
-(executable
- ((name discover)
-  (flags (:standard -w +A-29))))
diff --git a/src/unix/dune b/src/unix/dune
new file mode 100644
index 000000000..9b78b5d7b
--- /dev/null
+++ b/src/unix/dune
@@ -0,0 +1,180 @@
+;; pre-processing cppo files
+
+(rule
+ (targets lwt_unix.ml)
+ (deps (:ml lwt_unix.cppo.ml))
+ (action
+  (chdir %{project_root}
+   (run %{bin:cppo} -V OCAML:%{ocaml_version} %{ml} -o %{targets}))))
+
+(rule
+ (targets lwt_unix.mli)
+ (deps (:ml lwt_unix.cppo.mli))
+ (action
+  (chdir %{project_root}
+   (run %{bin:cppo} -V OCAML:%{ocaml_version} %{ml} -o %{targets}))))
+
+;; lwt feature discovery
+;;
+;; we use 2 config files
+;;
+;; - ocamlc_config which is generated here from calling 'ocamlc -config'
+;; - lwt_config which is optionally generated by src/utils/configure.ml
+;;   and contains configuration options for libev, pthread, android etc.
+;;
+;; The later configration file can be used for development and by opam
+;; to enable features based on the system configuration.
+
+;; run ocamlc -config
+(rule
+ (targets ocamlc_config)
+ (action (with-stdout-to %{targets} (run %{ocamlc} -config))))
+
+;; note; the call to (and dependency on) ocamlfind is avoided by adding:
+;; -ocamlc %{ocamlc}
+;; however, this only works on ocaml >= 4.04 due to passing options to ocamlc as
+;; "-cclib -o -cclib <file>"
+(rule
+ (targets
+  unix_c_flags.sexp unix_c_library_flags.sexp lwt_config.h lwt_config.ml)
+ (deps (:exe config/discover.exe) ocamlc_config lwt_config)
+ (action (run %{exe} -ocamlc-config ocamlc_config -lwt-config lwt_config)))
+
+;; main library
+;; Lwt_unix_jobs_generated and Lwt_config should be hidden
+
+(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 unix threads)
+ (preprocess (pps bisect_ppx -conditional))
+ (flags (:standard -w +A-29))
+ (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
+  windows_read
+  unix_bytes_read
+  windows_bytes_read
+  unix_write
+  windows_write
+  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_bytes_recv_msg
+  unix_send_msg
+  unix_bytes_send_msg
+  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
+  windows_read_job
+  unix_bytes_read_job
+  windows_bytes_read_job
+  unix_write_job
+  windows_write_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)
+ (install_c_headers lwt_config lwt_unix)
+ (c_flags (:include unix_c_flags.sexp))
+ (c_library_flags (:include unix_c_library_flags.sexp)))
diff --git a/src/unix/jbuild b/src/unix/jbuild
deleted file mode 100644
index 8eaadf4b4..000000000
--- a/src/unix/jbuild
+++ /dev/null
@@ -1,190 +0,0 @@
-(jbuild_version 1)
-
-;; pre-processing cppo files
-
-(rule
- ((targets (lwt_unix.ml))
-  (deps    (lwt_unix.cppo.ml))
-  (action
-   (chdir ${ROOT} (run ${bin:cppo} -V OCAML:${ocaml_version} ${<} -o ${@})))))
-
-(rule
- ((targets (lwt_unix.mli))
-  (deps    (lwt_unix.cppo.mli))
-  (action
-   (chdir ${ROOT} (run ${bin:cppo} -V OCAML:${ocaml_version} ${<} -o ${@})))))
-
-;; lwt feature discovery
-;;
-;; we use 2 config files
-;;
-;; - ocamlc_config which is generated here from calling 'ocamlc -config'
-;; - lwt_config which is optionally generated by src/utils/configure.ml
-;;   and contains configuration options for libev, pthread, android etc.
-;;
-;; The later configration file can be used for development and by opam
-;; to enable features based on the system configuration.
-
-;; run ocamlc -config
-(rule
- ((targets (ocamlc_config))
-  (action (with-stdout-to ${@} (run ${OCAMLC} -config)))))
-
-;; note; the call to (and dependency on) ocamlfind is avoided by adding:
-;; -ocamlc ${OCAMLC}
-;; however, this only works on ocaml >= 4.04 due to passing options to ocamlc as
-;; "-cclib -o -cclib <file>"
-(rule
- ((targets (unix_c_flags.sexp
-            unix_c_library_flags.sexp
-            lwt_config.h
-            lwt_config.ml))
-  (deps (config/discover.exe ocamlc_config lwt_config))
-  (action (run ${<}
-    -ocamlc-config ocamlc_config      ;; generated above
-    -lwt-config lwt_config
-  ))))
-
-;; main library
-;; Lwt_unix_jobs_generated and Lwt_config should be hidden
-
-(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 unix threads))
-  (preprocess (pps (bisect_ppx -conditional)))
-  (flags (:standard -w +A-29))
-  (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
-    windows_read
-    unix_bytes_read
-    windows_bytes_read
-    unix_write
-    windows_write
-    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_bytes_recv_msg
-    unix_send_msg
-    unix_bytes_send_msg
-    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
-    windows_read_job
-    unix_bytes_read_job
-    windows_bytes_read_job
-    unix_write_job
-    windows_write_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
-  ))
-  (install_c_headers (
-    lwt_config
-    lwt_unix
-  ))
-  (c_flags (:include unix_c_flags.sexp))
-  (c_library_flags (:include unix_c_library_flags.sexp))
-))


Test patch:
diff --git a/test/core/dune b/test/core/dune
new file mode 100644
index 000000000..364b2c872
--- /dev/null
+++ b/test/core/dune
@@ -0,0 +1,10 @@
+(executable
+ (name main)
+ (ocamlopt_flags (:standard (:include ../../src/core/flambda.flag)))
+ (libraries lwttester)
+ (flags (:standard -w +A-40-42)))
+
+(alias
+ (name runtest)
+ (package lwt)
+ (action (run %{exe:main.exe})))
diff --git a/test/core/jbuild b/test/core/jbuild
deleted file mode 100644
index a6bd42cb5..000000000
--- a/test/core/jbuild
+++ /dev/null
@@ -1,12 +0,0 @@
-(jbuild_version 1)
-
-(executable
- ((name main)
-  (ocamlopt_flags (:standard (:include ../../src/core/flambda.flag)))
-  (libraries (lwttester))
-  (flags (:standard -w +A-40-42))))
-
-(alias
- ((name runtest)
-  (package lwt)
-  (action (run ${exe:main.exe}))))
diff --git a/test/dune b/test/dune
new file mode 100644
index 000000000..bee204a1b
--- /dev/null
+++ b/test/dune
@@ -0,0 +1,4 @@
+(library
+ (name lwttester)
+ (wrapped false)
+ (libraries lwt unix lwt.unix))
diff --git a/test/jbuild b/test/jbuild
deleted file mode 100644
index f6c47ddae..000000000
--- a/test/jbuild
+++ /dev/null
@@ -1,6 +0,0 @@
-(jbuild_version 1)
-
-(library
- ((name lwttester)
-  (wrapped false)
-  (libraries (lwt unix lwt.unix))))
diff --git a/test/packaging/README.md b/test/packaging/README.md
index 5eee09394..e29c7ad14 100644
--- a/test/packaging/README.md
+++ b/test/packaging/README.md
@@ -1,7 +1,7 @@
 # Packaging tests
 
 This directory contains a few tiny programs that *depend* on Lwt, through one of
-two build systems: Findlib or Jbuilder. Each program is built to ensure that Lwt
+two build systems: Findlib or Dune. Each program is built to ensure that Lwt
 packaging remains usable by Lwt users. To do this, run `make packaging-test`
 from the Lwt repository root. Before that, you may want to run
 `make install-for-packaging-test`. This will install Lwt and all helper
diff --git a/test/packaging/jbuilder/core/Makefile b/test/packaging/dune/core/Makefile
similarity index 56%
rename from test/packaging/jbuilder/core/Makefile
rename to test/packaging/dune/core/Makefile
index 8285322c3..bec6ec2bb 100644
--- a/test/packaging/jbuilder/core/Makefile
+++ b/test/packaging/dune/core/Makefile
@@ -1,8 +1,8 @@
 .PHONY : test
 test : clean
-	jbuilder build user.exe --root .
+	dune build user.exe --root .
 	_build/default/user.exe
 
 .PHONY : clean
 clean :
-	jbuilder clean --root .
+	dune clean --root .
diff --git a/test/packaging/dune/core/dune b/test/packaging/dune/core/dune
new file mode 100644
index 000000000..bbdd2aecc
--- /dev/null
+++ b/test/packaging/dune/core/dune
@@ -0,0 +1,3 @@
+(executable
+ (name user)
+ (libraries lwt))
diff --git a/test/packaging/jbuilder/core/user.ml b/test/packaging/dune/core/user.ml
similarity index 100%
rename from test/packaging/jbuilder/core/user.ml
rename to test/packaging/dune/core/user.ml
diff --git a/test/packaging/jbuilder/ppx/Makefile b/test/packaging/dune/ppx/Makefile
similarity index 56%
rename from test/packaging/jbuilder/ppx/Makefile
rename to test/packaging/dune/ppx/Makefile
index 8285322c3..bec6ec2bb 100644
--- a/test/packaging/jbuilder/ppx/Makefile
+++ b/test/packaging/dune/ppx/Makefile
@@ -1,8 +1,8 @@
 .PHONY : test
 test : clean
-	jbuilder build user.exe --root .
+	dune build user.exe --root .
 	_build/default/user.exe
 
 .PHONY : clean
 clean :
-	jbuilder clean --root .
+	dune clean --root .
diff --git a/test/packaging/dune/ppx/dune b/test/packaging/dune/ppx/dune
new file mode 100644
index 000000000..0f5c7809d
--- /dev/null
+++ b/test/packaging/dune/ppx/dune
@@ -0,0 +1,4 @@
+(executable
+ (name user)
+ (libraries lwt)
+ (preprocess (pps lwt_ppx)))
diff --git a/test/packaging/jbuilder/ppx/user.ml b/test/packaging/dune/ppx/user.ml
similarity index 100%
rename from test/packaging/jbuilder/ppx/user.ml
rename to test/packaging/dune/ppx/user.ml
diff --git a/test/packaging/jbuilder/preemptive/Makefile b/test/packaging/dune/preemptive/Makefile
similarity index 56%
rename from test/packaging/jbuilder/preemptive/Makefile
rename to test/packaging/dune/preemptive/Makefile
index 8285322c3..bec6ec2bb 100644
--- a/test/packaging/jbuilder/preemptive/Makefile
+++ b/test/packaging/dune/preemptive/Makefile
@@ -1,8 +1,8 @@
 .PHONY : test
 test : clean
-	jbuilder build user.exe --root .
+	dune build user.exe --root .
 	_build/default/user.exe
 
 .PHONY : clean
 clean :
-	jbuilder clean --root .
+	dune clean --root .
diff --git a/test/packaging/dune/preemptive/dune b/test/packaging/dune/preemptive/dune
new file mode 100644
index 000000000..d9c5a0ef4
--- /dev/null
+++ b/test/packaging/dune/preemptive/dune
@@ -0,0 +1,3 @@
+(executable
+ (name user)
+ (libraries lwt.unix))
diff --git a/test/packaging/jbuilder/preemptive/user.ml b/test/packaging/dune/preemptive/user.ml
similarity index 100%
rename from test/packaging/jbuilder/preemptive/user.ml
rename to test/packaging/dune/preemptive/user.ml
diff --git a/test/packaging/jbuilder/unix/Makefile b/test/packaging/dune/unix/Makefile
similarity index 56%
rename from test/packaging/jbuilder/unix/Makefile
rename to test/packaging/dune/unix/Makefile
index 8285322c3..bec6ec2bb 100644
--- a/test/packaging/jbuilder/unix/Makefile
+++ b/test/packaging/dune/unix/Makefile
@@ -1,8 +1,8 @@
 .PHONY : test
 test : clean
-	jbuilder build user.exe --root .
+	dune build user.exe --root .
 	_build/default/user.exe
 
 .PHONY : clean
 clean :
-	jbuilder clean --root .
+	dune clean --root .
diff --git a/test/packaging/dune/unix/dune b/test/packaging/dune/unix/dune
new file mode 100644
index 000000000..d9c5a0ef4
--- /dev/null
+++ b/test/packaging/dune/unix/dune
@@ -0,0 +1,3 @@
+(executable
+ (name user)
+ (libraries lwt.unix))
diff --git a/test/packaging/jbuilder/unix/user.ml b/test/packaging/dune/unix/user.ml
similarity index 100%
rename from test/packaging/jbuilder/unix/user.ml
rename to test/packaging/dune/unix/user.ml
diff --git a/test/packaging/jbuilder/core/jbuild b/test/packaging/jbuilder/core/jbuild
deleted file mode 100644
index f94e3fe04..000000000
--- a/test/packaging/jbuilder/core/jbuild
+++ /dev/null
@@ -1,5 +0,0 @@
-(jbuild_version 1)
-
-(executable
- ((name user)
-  (libraries (lwt))))
diff --git a/test/packaging/jbuilder/ppx/jbuild b/test/packaging/jbuilder/ppx/jbuild
deleted file mode 100644
index 226a2868f..000000000
--- a/test/packaging/jbuilder/ppx/jbuild
+++ /dev/null
@@ -1,6 +0,0 @@
-(jbuild_version 1)
-
-(executable
- ((name user)
-  (libraries (lwt))
-  (preprocess (pps (lwt_ppx)))))
diff --git a/test/packaging/jbuilder/preemptive/jbuild b/test/packaging/jbuilder/preemptive/jbuild
deleted file mode 100644
index ed97ecbbb..000000000
--- a/test/packaging/jbuilder/preemptive/jbuild
+++ /dev/null
@@ -1,5 +0,0 @@
-(jbuild_version 1)
-
-(executable
- ((name user)
-  (libraries (lwt.unix))))
diff --git a/test/packaging/jbuilder/unix/jbuild b/test/packaging/jbuilder/unix/jbuild
deleted file mode 100644
index ed97ecbbb..000000000
--- a/test/packaging/jbuilder/unix/jbuild
+++ /dev/null
@@ -1,5 +0,0 @@
-(jbuild_version 1)
-
-(executable
- ((name user)
-  (libraries (lwt.unix))))
diff --git a/test/ppx/dune b/test/ppx/dune
new file mode 100644
index 000000000..bc6f4d2f9
--- /dev/null
+++ b/test/ppx/dune
@@ -0,0 +1,10 @@
+(executable
+ (name main)
+ (libraries lwttester)
+ (preprocess (pps lwt_ppx))
+ (flags (:standard -warn-error -22)))
+
+(alias
+ (name runtest)
+ (package lwt)
+ (action (run %{exe:main.exe})))
diff --git a/test/ppx/jbuild b/test/ppx/jbuild
deleted file mode 100644
index 964fbe2bf..000000000
--- a/test/ppx/jbuild
+++ /dev/null
@@ -1,13 +0,0 @@
-(jbuild_version 1)
-
-(executable
- ((name main)
-  (libraries (lwttester))
-  (preprocess (pps (lwt_ppx)))
-  (flags (:standard -warn-error -22))
-))
-
-(alias
- ((name runtest)
-  (package lwt)
-  (action (run ${exe:main.exe}))))
diff --git a/test/ppx_expect/dune b/test/ppx_expect/dune
new file mode 100644
index 000000000..f3a8d6fb5
--- /dev/null
+++ b/test/ppx_expect/dune
@@ -0,0 +1,9 @@
+(executable
+ (name main)
+ (libraries lwttester))
+
+(alias
+ (name runtest)
+ (package lwt_ppx)
+ (deps (source_tree cases))
+ (action (run %{exe:main.exe})))
diff --git a/test/ppx_expect/jbuild b/test/ppx_expect/jbuild
deleted file mode 100644
index 5ff1a7058..000000000
--- a/test/ppx_expect/jbuild
+++ /dev/null
@@ -1,11 +0,0 @@
-(jbuild_version 1)
-
-(executable
- ((name main)
-  (libraries (lwttester))))
-
-(alias
- ((name runtest)
-  (package lwt_ppx)
-  (deps ((files_recursively_in cases)))
-  (action (run ${exe:main.exe}))))
diff --git a/test/react/dune b/test/react/dune
new file mode 100644
index 000000000..7d236bf6b
--- /dev/null
+++ b/test/react/dune
@@ -0,0 +1,8 @@
+(executable
+ (name main)
+ (libraries lwt_react lwttester))
+
+(alias
+ (name runtest)
+ (package lwt_react)
+ (action (run %{exe:main.exe})))
diff --git a/test/react/jbuild b/test/react/jbuild
deleted file mode 100644
index 5b3699272..000000000
--- a/test/react/jbuild
+++ /dev/null
@@ -1,10 +0,0 @@
-(jbuild_version 1)
-
-(executable
- ((name main)
-  (libraries (lwt_react lwttester))))
-
-(alias
- ((name runtest)
-  (package lwt_react)
-  (action (run ${exe:main.exe}))))
diff --git a/test/unix/dune b/test/unix/dune
new file mode 100644
index 000000000..adeed5bf7
--- /dev/null
+++ b/test/unix/dune
@@ -0,0 +1,13 @@
+(rule
+ (targets test_lwt_unix.ml)
+ (deps (:ml test_lwt_unix.cppo.ml))
+ (action (run %{bin:cppo} -V OCAML:%{ocaml_version} %{ml} -o %{targets})))
+
+(executable
+ (name main)
+ (libraries lwttester))
+
+(alias
+ (name runtest)
+ (package lwt)
+ (action (run %{exe:main.exe})))
diff --git a/test/unix/jbuild b/test/unix/jbuild
deleted file mode 100644
index 0fce9092e..000000000
--- a/test/unix/jbuild
+++ /dev/null
@@ -1,15 +0,0 @@
-(jbuild_version 1)
-
-(rule
- ((targets (test_lwt_unix.ml))
-  (deps    (test_lwt_unix.cppo.ml))
-  (action  (run ${bin:cppo} -V OCAML:${ocaml_version} ${<} -o ${@}))))
-
-(executable
- ((name main)
-  (libraries (lwttester))))
-
-(alias
- ((name runtest)
-  (package lwt)
-  (action (run ${exe:main.exe}))))