[build] Use plain dune files instead of make-generated JBuilder/OCaml ones

Summary:
With the introduction of environments and profiles we no longer need
to generate most dune files in libraries via make. Also, those dune
builds don't need to be in OCaml.

In addition to converting build files to plain sexp definitions, this
patch also:
- Adjusts copyrightCheck to work correctly with sexp-based dune files.
- Adds auto-formatting for sexp-based dune files.

Reviewed By: jvillard

Differential Revision: D20250208

fbshipit-source-id: 495aeaa99
master
Artem Pianykh 5 years ago committed by Facebook GitHub Bot
parent fc5b092779
commit 9fc048b503

5
.gitignore vendored

@ -177,11 +177,6 @@ infer/src/.project
/infer/src/_build
/infer/src/dune.common
/infer/src/dune
/infer/src/atd/dune
/infer/src/base/dune
/infer/src/IR/dune
/infer/src/istd/dune
/infer/src/scripts/dune
/infer/src/dune-workspace
.merlin

@ -223,7 +223,7 @@ fb-setup:
fmt:
parallel $(OCAMLFORMAT_EXE) -i ::: $$(git diff --name-only --diff-filter=ACMRU $$(git merge-base origin/master HEAD) | grep "\.mli\?$$")
DUNE_ML:=$(shell find * -name 'dune*.in' | grep -v workspace)
DUNE_ML:=$(shell find * -name 'dune*.in' | grep -v workspace | grep -v infer-source)
.PHONY: fmt_dune
fmt_dune:

@ -0,0 +1,18 @@
; 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.
(library
(name InferIR)
(public_name InferIR)
(flags
(:standard -open Core -open InferStdlib -open IStd -open InferGenerated
-open InferBase))
(libraries core zarith InferStdlib InferGenerated InferBase)
(preprocess
(pps ppx_compare)))
(documentation
(package InferIR)
(mld_files index))

@ -1,27 +0,0 @@
(* -*- 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! *)
;;
Format.sprintf
{|
(library
(name InferIR)
(public_name InferIR)
(flags (:standard -open Core -open InferStdlib -open IStd -open InferGenerated -open InferBase))
(libraries %s)
(preprocess (pps ppx_compare))
)
(documentation
(package InferIR)
(mld_files index)
)
|}
(String.concat " " ("InferBase" :: common_libraries))
|> Jbuild_plugin.V1.send

@ -98,7 +98,7 @@ all: infer
GENERATED_FROM_AUTOCONF = dune.common dune-workspace base/Version.ml
GENERATED_DUNES += dune atd/dune base/dune IR/dune istd/dune scripts/dune
GENERATED_DUNES += dune
SRC_BUILD_COMMON = $(GENERATED_FROM_AUTOCONF) $(GENERATED_DUNES) $(OCAML_SOURCES)
ifeq ($(BUILD_C_ANALYZERS),yes)
@ -307,12 +307,7 @@ $(GENERATED_DUNES): dune.common
$(QUIET)cat $+ > $@
dune: dune.in
atd/dune: atd/dune.in
base/dune: base/dune.in
deadcode/dune: deadcode/dune.in
IR/dune: IR/dune.in
istd/dune: istd/dune.in
scripts/dune: scripts/dune.in
.PHONY: clean
clean:

@ -0,0 +1,17 @@
; 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.
(library
(name InferGenerated)
(public_name InferGenerated)
(flags
(:standard -w -27-32-34-35-39))
(libraries atdgen core)
(preprocess
(pps ppx_compare)))
(documentation
(package InferGenerated)
(mld_files index))

@ -1,26 +0,0 @@
(* -*- 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! *)
;;
Format.sprintf
{|
(library
(name InferGenerated)
(public_name InferGenerated)
(flags (:standard -w -27-32-34-35-39))
(libraries atdgen core)
(preprocess (pps ppx_compare))
)
(documentation
(package InferGenerated)
(mld_files index)
)
|}
|> Jbuild_plugin.V1.send

@ -0,0 +1,18 @@
; 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.
(library
(name InferBase)
(public_name InferBase)
(flags
(:standard -open Core -open InferStdlib -open IStd -open InferGenerated))
(libraries cmdliner core mtime.clock.os parmap re sqlite3 zip InferGenerated
InferStdlib)
(preprocess
(pps ppx_compare ppx_enumerate)))
(documentation
(package InferBase)
(mld_files index))

@ -1,2 +1,7 @@
(lang dune 2.0)
; 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.
(using menhir 1.0)

@ -0,0 +1,17 @@
; 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.
(library
(name InferStdlib)
(public_name InferStdlib)
(flags
(:standard -open Core))
(libraries ANSITerminal core str yojson)
(preprocess
(pps ppx_compare)))
(documentation
(package InferStdlib)
(mld_files index))

@ -1,27 +0,0 @@
(* -*- 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! *)
;;
Format.sprintf
{|
(library
(name InferStdlib)
(public_name InferStdlib)
(flags (:standard -open Core))
(libraries %s)
(preprocess (pps ppx_compare))
)
(documentation
(package InferStdlib)
(mld_files index)
)
|}
(String.concat " " common_libraries)
|> Jbuild_plugin.V1.send

@ -0,0 +1,12 @@
; 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.
(executable
(name checkCopyright)
(modes byte exe)
(flags (:standard))
(libraries core str)
(preprocess
(pps ppx_compare)))

@ -1,20 +0,0 @@
(*
* 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! *)
;;
Format.sprintf
{|
(executable
(name checkCopyright)
(modes byte exe)
(flags (:standard))
(libraries core str)
(preprocess (pps ppx_compare))
)
|}
|> Jbuild_plugin.V1.send
Loading…
Cancel
Save