[oss] more flexible way to have opensource stubs

Summary:
- Open-source stubs are in a library with no dependencies
- That library is included in InferBase, but in facebook builds it
  contains no modules

Reviewed By: ezgicicek

Differential Revision: D20922574

fbshipit-source-id: af918a687
master
Jules Villard 5 years ago committed by Facebook GitHub Bot
parent e1093159b0
commit bf671af2b2

1
.gitignore vendored

@ -163,6 +163,7 @@ infer/src/.project
/infer/dune-workspace /infer/dune-workspace
/infer/src/dune.common /infer/src/dune.common
/infer/src/dune /infer/src/dune
/infer/src/opensource/dune
.merlin .merlin
# generated when looking for dead code # generated when looking for dead code

@ -76,7 +76,7 @@ GENERATED_FROM_AUTOCONF = dune.common ../dune-workspace base/Version.ml
.PHONY: dune-workspace .PHONY: dune-workspace
dune-workspace: ../dune-workspace dune-workspace: ../dune-workspace
GENERATED_DUNES += dune GENERATED_DUNES += dune opensource/dune
SRC_BUILD_COMMON = $(GENERATED_FROM_AUTOCONF) $(GENERATED_DUNES) $(OCAML_SOURCES) SRC_BUILD_COMMON = $(GENERATED_FROM_AUTOCONF) $(GENERATED_DUNES) $(OCAML_SOURCES)
ifeq ($(BUILD_C_ANALYZERS),yes) ifeq ($(BUILD_C_ANALYZERS),yes)
@ -243,6 +243,7 @@ $(GENERATED_DUNES): dune.common
dune: dune.in dune: dune.in
deadcode/dune: deadcode/dune.in deadcode/dune: deadcode/dune.in
opensource/dune: opensource/dune.in
.PHONY: clean .PHONY: clean
clean: clean:

@ -6,9 +6,8 @@
(library (library
(name InferBase) (name InferBase)
(public_name infer.InferBase) (public_name infer.InferBase)
(flags (flags (:standard -open Core -open InferStdlib -open IStd -open InferGenerated -open OpenSource))
(:standard -open Core -open InferStdlib -open IStd -open InferGenerated))
(libraries cmdliner core mtime.clock.os parmap re sqlite3 zip InferGenerated (libraries cmdliner core mtime.clock.os parmap re sqlite3 zip InferGenerated
InferStdlib) InferStdlib OpenSource)
(preprocess (preprocess
(pps ppx_compare ppx_enumerate))) (pps ppx_compare ppx_enumerate)))

@ -10,9 +10,7 @@
let ( ^/ ) = Filename.concat let ( ^/ ) = Filename.concat
let source_dirs = let source_dirs =
(if facebook then "facebook" else "opensource") (if clang then ["al"; "clang"; "unit" ^/ "clang"] else ["clang_stubs"; "unit" ^/ "clang_stubs"])
:: ( ( if clang then ["al"; "clang"; "unit" ^/ "clang"]
else ["clang_stubs"; "unit" ^/ "clang_stubs"] )
@ [ (if java then "java" else "java_stubs") @ [ (if java then "java" else "java_stubs")
; "absint" ; "absint"
; "backend" ; "backend"
@ -26,11 +24,10 @@ let source_dirs =
; "nullsafe" ; "nullsafe"
; "pulse" ; "pulse"
; "quandary" ; "quandary"
; "scuba"
; "test_determinator" ; "test_determinator"
; "topl" ; "topl"
; "unit" ; "unit"
; "unit" ^/ "nullsafe" ] ) ; "unit" ^/ "nullsafe" ]
let infer_binaries = ["infer"; "inferunit"] @ if facebook then ["InferCreateTraceViewLinks"] else [] let infer_binaries = ["infer"; "inferunit"] @ if facebook then ["InferCreateTraceViewLinks"] else []
@ -60,6 +57,8 @@ let infer_cflags =
[ "-open" [ "-open"
; "Core" ; "Core"
; "-open" ; "-open"
; "OpenSource"
; "-open"
; "InferStdlib" ; "InferStdlib"
; "-open" ; "-open"
; "IStd" ; "IStd"

@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*) *)
open! IStd
module Call = struct module Call = struct
let dispatch = ProcnameDispatcher.Call.make_dispatcher [] let dispatch _ _ _ = None
end end

@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*) *)
open! IStd
module Call : sig module Call : sig
val dispatch : (Tenv.t, CostUtils.model, unit) ProcnameDispatcher.Call.dispatcher val dispatch : 'context -> 'procname_t -> 'arg_payload_FuncArg_t_list -> 'f option
end end

@ -5,6 +5,4 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*) *)
open! IStd
let is_subtype_of_fb_service_handler _tenv _name = false let is_subtype_of_fb_service_handler _tenv _name = false

@ -5,6 +5,4 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*) *)
open! IStd val is_subtype_of_fb_service_handler : 'tenv_t -> 'typ_Name_t -> bool
val is_subtype_of_fb_service_handler : Tenv.t -> Typ.Name.t -> bool

@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*) *)
open! IStd
let is_custom_init _ _ = false let is_custom_init _ _ = false
let is_logging_method _ = false let is_logging_method _ = false

@ -5,12 +5,10 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*) *)
open! IStd val is_custom_init : 'tenv_t -> 'procname_t -> bool
val is_custom_init : Tenv.t -> Procname.t -> bool val is_logging_method : 'procname_t -> bool
val is_logging_method : Procname.t -> bool val get_fbthreadsafe_class_annot : 'procname_t -> 'tenv_t -> (string * string) option
val get_fbthreadsafe_class_annot : Procname.t -> Tenv.t -> (string * string) option
val message_fbthreadsafe_class : string -> string -> string val message_fbthreadsafe_class : string -> string -> string

@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*) *)
open! IStd
type category = InferEvents type category = InferEvents
let log _ _ = () let log _ _ = ()

@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*) *)
open! IStd
type category = InferEvents type category = InferEvents
val log : category -> string list -> unit val log : category -> string list -> unit

@ -0,0 +1,21 @@
(* -*- 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! *)
(* include the open-source modules only in open-source build modes, otherwise this library is empty *)
;;
Jbuild_plugin.V1.send
(Format.sprintf {|
(library
(name OpenSource)
(public_name infer.OpenSource)
%s
)
|}
(if facebook then "(modules)" else "(modules :standard)"))
Loading…
Cancel
Save