You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
131 lines
3.9 KiB
131 lines
3.9 KiB
(* -*- 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! *)
|
|
|
|
(*
|
|
* A known issue: At the moment of writing warning 14 (illegal backslash
|
|
* escape in string) does not manifest as an error, presumably due to
|
|
* peculiarities in communication between preprocessor and compiler.
|
|
* Still leave it for visibility and in hope that the issue will be
|
|
* fixed one day.
|
|
*)
|
|
let fatal_warnings =
|
|
"+3+5+6+8+10+11+12+14+18+19+20+21+23+26+29+27+28+32+33+34+35+37+38+39+50+52+57+60"
|
|
|
|
|
|
let warnings = fatal_warnings ^ "-4-9-40-41-42-45-48"
|
|
|
|
let ocamlc_flags =
|
|
[ "-g"
|
|
; "-short-paths"
|
|
; "-safe-string"
|
|
; "-principal"
|
|
; "-strict-formats"
|
|
; "-strict-sequence"
|
|
; "-bin-annot" ]
|
|
|
|
|
|
let lenient_flags = ocamlc_flags @ ["-w"; warnings] |> String.concat " "
|
|
|
|
let strict_flags =
|
|
ocamlc_flags @ ["-w"; warnings; "-warn-error"; fatal_warnings] |> String.concat " "
|
|
|
|
|
|
let env_stanza =
|
|
Format.sprintf
|
|
{|
|
|
(env
|
|
(dev
|
|
(flags %s)
|
|
(inline_tests enabled))
|
|
(opt
|
|
(flags %s)
|
|
(ocamlopt_flags (:standard -O3)))
|
|
(dev-noerror
|
|
(flags %s)
|
|
(inline_tests enabled))
|
|
)
|
|
|}
|
|
strict_flags lenient_flags lenient_flags
|
|
|
|
|
|
(** Put this *first* in (libraries) specifications to prevent a clash between extlib's and base64's
|
|
versions of Base64. Only Javalib depends on extlib so do it conditionally to avoid introducing a
|
|
new dependency in the clang-only build. *)
|
|
let extlib_if_java = if java then "extlib" else ""
|
|
|
|
let infer_exe_stanza =
|
|
Printf.sprintf
|
|
{|(executable
|
|
(name infer)
|
|
(modes byte_complete exe)
|
|
(modules Infer)
|
|
(flags (:standard -open Core -open IStdlib -open IStd -open IBase -open IR -open Backend -open Integration -open Biabduction -open TestDeterminators -open ClangFrontend -open ASTLanguage %s -open JavaFrontend %s))
|
|
(libraries %s core IStdlib IBase IR Backend Integration Biabduction TestDeterminators ClangFrontend ASTLanguage)
|
|
(preprocess (pps ppx_compare))
|
|
(promote (until-clean) (into ../bin))
|
|
)|}
|
|
(if clang then "" else "-open ClangFrontendStubs")
|
|
(if java then "" else "-open JavaFrontendStubs")
|
|
extlib_if_java
|
|
|
|
|
|
let inferunit_stanza =
|
|
Printf.sprintf
|
|
{|(executable
|
|
(name inferunit)
|
|
(modes byte_complete exe)
|
|
(modules Inferunit)
|
|
(flags (:standard -open Core -open IStdlib -open IStd -open IBase -open Backend -open Integration -open UnitTests -open NullsafeUnitTests -open ClangFrontend %s))
|
|
(libraries %s oUnit core IStdlib IBase Backend Integration UnitTests NullsafeUnitTests %s)
|
|
(preprocess (pps ppx_compare))
|
|
(promote (until-clean) (into ../bin))
|
|
)|}
|
|
(if clang then "-open ClangUnitTests" else "-open ClangFrontendStubs")
|
|
extlib_if_java
|
|
(if clang then "ClangUnitTests" else "")
|
|
|
|
|
|
let infertop_stanza =
|
|
Format.sprintf
|
|
{|
|
|
(executable
|
|
(name infertop)
|
|
(modes byte_complete)
|
|
(modules Infertop)
|
|
(flags (:standard -open Core -open IStdlib -open IStd))
|
|
(libraries %s utop Absint ASTLanguage ATDGenerated Backend IBase Biabduction BO Checkers Concurrency Costlib CStubs IR IStdlib Labs Nullsafe Pulselib Quandary Integration TestDeterminators TOPLlib UnitTests)
|
|
(link_flags (-linkall -warn-error -31))
|
|
(preprocess (pps ppx_compare))
|
|
(promote (until-clean) (into ../bin))
|
|
)
|
|
|}
|
|
extlib_if_java
|
|
|
|
|
|
let inferCreateTraceViewLinks_stanza =
|
|
{|(executable
|
|
(name InferCreateTraceViewLinks)
|
|
(modes byte_complete exe)
|
|
(modules InferCreateTraceViewLinks)
|
|
(flags (:standard -open Core -open IStdlib -open IStd -open ATDGenerated -open IBase))
|
|
(libraries core async IStdlib ATDGenerated IBase)
|
|
(preprocess (pps ppx_compare))
|
|
(promote (until-clean) (into ../bin))
|
|
)|}
|
|
|
|
|
|
(** The build stanzas to be passed to dune *)
|
|
let stanzas =
|
|
[env_stanza; infer_exe_stanza; inferunit_stanza; infertop_stanza]
|
|
@ if facebook then [inferCreateTraceViewLinks_stanza] else []
|
|
|
|
|
|
;;
|
|
Jbuild_plugin.V1.send (String.concat "\n" stanzas)
|