From 9fc048b503cc6c0862f41b852abc32aa0497e209 Mon Sep 17 00:00:00 2001 From: Artem Pianykh Date: Wed, 11 Mar 2020 05:57:11 -0700 Subject: [PATCH] [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 --- .gitignore | 5 ----- Makefile | 2 +- infer/src/IR/dune | 18 ++++++++++++++++++ infer/src/IR/dune.in | 27 --------------------------- infer/src/Makefile | 7 +------ infer/src/atd/dune | 17 +++++++++++++++++ infer/src/atd/dune.in | 26 -------------------------- infer/src/base/dune | 18 ++++++++++++++++++ infer/src/dune-project | 5 +++++ infer/src/istd/dune | 17 +++++++++++++++++ infer/src/istd/dune.in | 27 --------------------------- infer/src/scripts/dune | 12 ++++++++++++ infer/src/scripts/dune.in | 20 -------------------- 13 files changed, 89 insertions(+), 112 deletions(-) create mode 100644 infer/src/IR/dune delete mode 100644 infer/src/IR/dune.in create mode 100644 infer/src/atd/dune delete mode 100644 infer/src/atd/dune.in create mode 100644 infer/src/base/dune create mode 100644 infer/src/istd/dune delete mode 100644 infer/src/istd/dune.in create mode 100644 infer/src/scripts/dune delete mode 100644 infer/src/scripts/dune.in diff --git a/.gitignore b/.gitignore index 42089bca0..d8c4b74c1 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/Makefile b/Makefile index cfc5f7708..c55a86d7f 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/infer/src/IR/dune b/infer/src/IR/dune new file mode 100644 index 000000000..9f4d02425 --- /dev/null +++ b/infer/src/IR/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)) diff --git a/infer/src/IR/dune.in b/infer/src/IR/dune.in deleted file mode 100644 index 12123142c..000000000 --- a/infer/src/IR/dune.in +++ /dev/null @@ -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 diff --git a/infer/src/Makefile b/infer/src/Makefile index 555d27497..6dc01572b 100644 --- a/infer/src/Makefile +++ b/infer/src/Makefile @@ -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: diff --git a/infer/src/atd/dune b/infer/src/atd/dune new file mode 100644 index 000000000..3de89b88e --- /dev/null +++ b/infer/src/atd/dune @@ -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)) diff --git a/infer/src/atd/dune.in b/infer/src/atd/dune.in deleted file mode 100644 index e33b7b496..000000000 --- a/infer/src/atd/dune.in +++ /dev/null @@ -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 diff --git a/infer/src/base/dune b/infer/src/base/dune new file mode 100644 index 000000000..447be7d04 --- /dev/null +++ b/infer/src/base/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 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)) diff --git a/infer/src/dune-project b/infer/src/dune-project index b5b88dc0f..1d537821a 100644 --- a/infer/src/dune-project +++ b/infer/src/dune-project @@ -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) diff --git a/infer/src/istd/dune b/infer/src/istd/dune new file mode 100644 index 000000000..006e1a222 --- /dev/null +++ b/infer/src/istd/dune @@ -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)) diff --git a/infer/src/istd/dune.in b/infer/src/istd/dune.in deleted file mode 100644 index b6b174839..000000000 --- a/infer/src/istd/dune.in +++ /dev/null @@ -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 diff --git a/infer/src/scripts/dune b/infer/src/scripts/dune new file mode 100644 index 000000000..10e5892e8 --- /dev/null +++ b/infer/src/scripts/dune @@ -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))) diff --git a/infer/src/scripts/dune.in b/infer/src/scripts/dune.in deleted file mode 100644 index caef1ddc1..000000000 --- a/infer/src/scripts/dune.in +++ /dev/null @@ -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