forked from facebook/infer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[jbuilder] turn I{Std,List} and atd-generated files into libraries
Summary: This simplifies the jbuild files: no need to list these files explicitly anymore, nor to exclude them explicitly from the main `InferModules` library (due to their different compilation flags). Isolate common parts into jbuild.common do `cat`-based code inclusion into jbuild files to factorize code. Reviewed By: jberdine Differential Revision: D5678328 fbshipit-source-id: 6d7d925
- Loading branch information
1 parent
e8a0599
commit c16884b
Showing
24 changed files
with
173 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,7 @@ us a line at [email protected]. Thanks! | |
|
||
### OCaml | ||
|
||
- The module IStd (infer/src/base/IStd.ml) is automatically opened in every file. Beware that this | ||
- The module IStd (infer/src/istd/IStd.ml) is automatically opened in every file. Beware that this | ||
can cause weird errors such as: | ||
``` | ||
$ pwd | ||
|
@@ -85,10 +85,6 @@ Error: This variant expression is expected to have type 'a list | |
The constructor true does not belong to type list | ||
``` | ||
|
||
If your new module cannot compile with `IStd`, for instance because it's generated code, modify | ||
the line in infer/src/Makefile that adds `-open IStd` so that your module is excluded (see how | ||
it's done for other such modules, eg IStd.ml). | ||
|
||
- All modules open `IStd` using `open! IStd`. This is to make that fact more explicit (there's also | ||
the compilation flag mentioned above), and also it helps merlin find the right types. In | ||
particular this also opens `Core.Std`. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
B ../_build/default/atd | ||
FLG -open InferGenerated -g -short-paths -safe-string -principal -strict-formats -strict-sequence -bin-annot -w +3+5+6+8+10+11+12+18+19+20+21+23+26+29+27+32+33+34+35+37+38+39+50+52+57-4-9-40-41-42-45-48 -w -27-32-34-35-39 | ||
PKG atd | ||
PKG atdgen | ||
PKG biniou | ||
PKG easy-format | ||
PKG str | ||
PKG unix | ||
PKG yojson | ||
S . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
(* -*- tuareg -*- *) | ||
(* NOTE: prepend jbuild.common to this file! *) | ||
|
||
let cflags = common_cflags @ ["-w"; "-27-32-34-35-39"] | ||
|
||
;; Format.sprintf {| | ||
(library | ||
((name InferGenerated) | ||
(flags (%s)) | ||
(libraries (atdgen)) | ||
)) | ||
|} | ||
(String.concat " " cflags) | ||
|> Jbuild_plugin.V1.send |
File renamed without changes.
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
B ../_build/default/istd | ||
PKG ANSITerminal | ||
PKG atdgen | ||
PKG cmdliner | ||
PKG core | ||
PKG javalib | ||
PKG oUnit | ||
PKG parmap | ||
PKG ppx_compare | ||
PKG ptrees | ||
PKG sawja | ||
PKG str | ||
PKG unix | ||
PKG xmlm | ||
PKG yojson | ||
PKG zip | ||
FLG -principal -safe-string -short-paths -strict-formats -strict-sequence | ||
FLG -w +a-4-9-40-41-42-44-45-48-60 | ||
S . |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(* -*- tuareg -*- *) | ||
(* NOTE: prepend jbuild.common to this file! *) | ||
|
||
;; Format.sprintf {| | ||
(library | ||
((name InferStdlib) | ||
(flags (%s)) | ||
(libraries (%s)) | ||
)) | ||
|} | ||
(String.concat " " common_cflags) (String.concat " " common_libraries) | ||
|> Jbuild_plugin.V1.send |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
(* -*- tuareg -*- *) | ||
(* use strings so that it looks like OCaml even before substituting, e.g. to use ocamlformat *) | ||
|
||
let is_yes = String.equal "yes" | ||
|
||
let clang = is_yes "@BUILD_C_ANALYZERS@" | ||
|
||
let java = is_yes "@BUILD_JAVA_ANALYZERS@" | ||
|
||
let facebook = is_yes "@IS_FACEBOOK_TREE@" | ||
|
||
let extra_cflags = if "@EXTRA_CFLAGS" = "" then [] else ["@EXTRA_CFLAGS@"] | ||
|
||
let common_cflags = | ||
let fatal_warnings = "+3+5+6+8+10+11+12+18+19+20+21+23+26+29+27+32+33+34+35+37+38+39+50+52+57" in | ||
let warnings = fatal_warnings ^ "-4-9-40-41-42-45-48" in | ||
let common_flags = | ||
[ "-g" | ||
; "-short-paths" | ||
; "-safe-string" | ||
; "-principal" | ||
; "-strict-formats" | ||
; "-strict-sequence" | ||
; "-bin-annot" | ||
; "-w" | ||
; warnings ] | ||
in | ||
match Jbuild_plugin.V1.context with | ||
| "test" | ||
-> "-warn-error" :: fatal_warnings :: common_flags | ||
| "default" | ||
-> common_flags | ||
| ctx | ||
-> invalid_arg ("unknown context: " ^ ctx) | ||
|
||
let common_libraries = | ||
(if java then ["javalib"; "ptrees"; "sawja"] else []) | ||
@ [ "ANSITerminal" | ||
; "atdgen" | ||
; "cmdliner" | ||
; "core" | ||
; "extlib" | ||
; "oUnit" | ||
; "parmap" | ||
; "str" | ||
; "unix" | ||
; "xmlm" | ||
; "yojson" | ||
; "zip" ] |
Oops, something went wrong.