(* -*- tuareg -*- *) (* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) (* NOTE: prepend dune.common to this file! *) let ( ^/ ) = Filename.concat let source_dirs = (if clang then ["unit" ^/ "clang"] else ["unit" ^/ "clang_stubs"]) @ ["unit"; "unit" ^/ "nullsafe"] let infer_binaries = ["infer"; "inferunit"] @ if facebook then ["InferCreateTraceViewLinks"] else [] let env_stanza = Format.sprintf {| (env (dev (flags %s)) (opt (flags %s) (ocamlopt_flags (:standard -O3))) (test (flags %s)) ) |} lenient_flags lenient_flags strict_flags let infer_cflags = ( [ "-open" ; "Core" ; "-open" ; "Biabduction" ; "-open" ; "BO" ; "-open" ; "Nullsafe" ; "-open" ; "Pulselib" ; "-open" ; "Checkers" ; "-open" ; "Costlib" ; "-open" ; "Quandary" ; "-open" ; "TOPLlib" ; "-open" ; "Concurrency" ; "-open" ; "Labs" ; "-open" ; "Absint" ; "-open" ; "OpenSource" ; "-open" ; "IStdlib" ; "-open" ; "IStd" ; "-open" ; "ATDGenerated" ; "-open" ; "IR" ; "-open" ; "IBase" ; "-open" ; "CStubs" ; "-open" ; "Backend" ; "-open" ; "JavaFrontend" ; "-open" ; "ClangFrontend" ; "-open" ; "ASTLanguage" ; "-open" ; "TestDeterminators" ; "-open" ; "Integration" ] @ (if java then [] else ["-open"; "JavaFrontendStubs"]) @ if clang then [] else ["-open"; "ClangFrontendStubs"] ) |> String.concat " " let main_lib_stanza = Format.sprintf {| (library (name InferModules) (public_name infer) (flags (:standard %s)) (libraries %s) (modules :standard \ %s infertop) (preprocess (pps ppx_compare ppx_fields_conv ppx_hash ppx_sexp_conv ppx_variants_conv -no-check)) ) |} infer_cflags (String.concat " " (* we need JavaFrontend first to avoid clashes around base64 vs extlib *) ( ("JavaFrontend" :: common_libraries) @ [ "IR" ; "CStubs" ; "Absint" ; "Biabduction" ; "Nullsafe" ; "BO" ; "Pulselib" ; "Checkers" ; "Costlib" ; "Quandary" ; "TOPLlib" ; "Concurrency" ; "Labs" ; "Backend" ; "ClangFrontend" ; "ASTLanguage" ; "TestDeterminators" ; "Integration" ] )) (String.concat " " infer_binaries) let infer_exe_stanza = Format.sprintf {| (executables (names %s) (modes byte_complete exe) (flags (:standard -open InferModules %s)) (libraries InferModules) (modules %s) (preprocess (pps ppx_compare ppx_fields_conv ppx_hash ppx_sexp_conv ppx_variants_conv -no-check)) (promote (until-clean) (into ../bin)) ) |} (String.concat " " infer_binaries) infer_cflags (String.concat " " infer_binaries) let infertop_stanza = Format.sprintf {| (executable (name infertop) (modes byte_complete) (flags (:standard %s)) (libraries utop InferModules) (link_flags (-linkall -warn-error -31)) (modules Infertop) (preprocess (pps ppx_compare ppx_fields_conv ppx_hash ppx_sexp_conv ppx_variants_conv -no-check)) (promote (until-clean) (into ../bin)) ) |} infer_cflags let flatten_sources_stanzas = List.map (fun source_dir -> [ Printf.sprintf "(copy_files# %s/*.ml{,i,l})" source_dir ; (* menhir doesn't support '# 1 ""' directives at the start of the file inserted by copy# actions *) Printf.sprintf "(copy_files %s/*.mly)" source_dir ] ) source_dirs |> List.concat (** The build stanzas to be passed to dune *) let stanzas = env_stanza :: main_lib_stanza :: infer_exe_stanza :: infertop_stanza :: flatten_sources_stanzas ;; String.concat "\n" stanzas |> Jbuild_plugin.V1.send