From 11bf7d9a39fa9c0b4739e23fd6eadf2daa2e41b5 Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Wed, 31 Oct 2018 11:16:12 -0700 Subject: [PATCH] [sledge] Build system support inline tests in all libraries Reviewed By: mbouaziz Differential Revision: D12854506 fbshipit-source-id: 34be9ee1f --- sledge/dune-common.in | 6 ++++-- sledge/src/dune.in | 3 ++- sledge/src/import/dune.in | 3 ++- sledge/src/llair/dune.in | 3 ++- sledge/src/symbheap/dune.in | 9 ++++----- sledge/src/trace/dune.in | 3 ++- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/sledge/dune-common.in b/sledge/dune-common.in index c79b0dfcb..82f250a1d 100644 --- a/sledge/dune-common.in +++ b/sledge/dune-common.in @@ -28,7 +28,7 @@ let coverage_ppx = let ppx_flags = match Jbuild_plugin.V1.context with "dev" -> "--debug" | _ -> "" -let flags deps = +let flags exe_or_lib deps = Printf.sprintf {|(flags (%s %s)) (ocamlc_flags (%s)) @@ -46,10 +46,12 @@ let flags deps = ppx_sexp_value ppx_trace %s - %s))|} + %s)) + %s|} common_flags (String.concat " " (List.map (fun d -> "-open " ^ String.capitalize_ascii d) deps)) ocamlc_flags ocamlopt_flags ppx_flags coverage_ppx + (match exe_or_lib with `lib -> "(inline_tests)" | _ -> "") let libraries deps = String.concat " " deps diff --git a/sledge/src/dune.in b/sledge/src/dune.in index 25933dbf4..b24b48821 100644 --- a/sledge/src/dune.in +++ b/sledge/src/dune.in @@ -24,4 +24,5 @@ Jbuild_plugin.V1.send %s (libraries cmdliner %s)) |} - (flags deps) (libraries deps) + (flags `exe deps) + (libraries deps) diff --git a/sledge/src/import/dune.in b/sledge/src/import/dune.in index 48e1810d5..8d18f876e 100644 --- a/sledge/src/import/dune.in +++ b/sledge/src/import/dune.in @@ -18,4 +18,5 @@ Jbuild_plugin.V1.send %s (libraries core_kernel zarith %s)) |} - (flags deps) (libraries deps) + (flags `lib deps) + (libraries deps) diff --git a/sledge/src/llair/dune.in b/sledge/src/llair/dune.in index 7cce5d468..72cc05913 100644 --- a/sledge/src/llair/dune.in +++ b/sledge/src/llair/dune.in @@ -18,4 +18,5 @@ Jbuild_plugin.V1.send %s (libraries ctypes ctypes.foreign llvm llvm.irreader llvm.analysis llvm.scalar_opts llvm.target %s)) |} - (flags deps) (libraries deps) + (flags `lib deps) + (libraries deps) diff --git a/sledge/src/symbheap/dune.in b/sledge/src/symbheap/dune.in index 2e7392fce..29895d9f9 100644 --- a/sledge/src/symbheap/dune.in +++ b/sledge/src/symbheap/dune.in @@ -10,12 +10,11 @@ let deps = ["import"; "trace"; "llair_"] ;; Jbuild_plugin.V1.send -@@ Format.sprintf - {| +@@ Format.sprintf {| (library (name symbheap) %s - (libraries %s) - (inline_tests)) + (libraries %s)) |} - (flags deps) (libraries deps) + (flags `lib deps) + (libraries deps) diff --git a/sledge/src/trace/dune.in b/sledge/src/trace/dune.in index af1562150..c25b0eca5 100644 --- a/sledge/src/trace/dune.in +++ b/sledge/src/trace/dune.in @@ -18,4 +18,5 @@ Jbuild_plugin.V1.send %s (libraries %s)) |} - (flags deps) (libraries deps) + (flags `lib deps) + (libraries deps)