[clang] add clang models to `CLANG_DEPS`

Summary:
This is helpful to make sure tests are up to date wrt the models.

Also made the Java deps depend on the models.jar instead of the model sources
as that's what the tests will be using. In particular, updating the sources of
the models will not update the results of a test unless someone rebuilds
models.jar, so rerunning the tests when the models haven't been rebuilt is
useless.

Reviewed By: akotulski

Differential Revision: D4635129

fbshipit-source-id: 75b4ab6
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent c5279a670f
commit 6e1b83a204

@ -64,28 +64,41 @@ ifeq ($(BUILD_JAVA_ANALYZERS),yes)
JAVA_HOME=$(USER_JAVA_HOME)
endif
JAVA_BUILTINS_SOURCES = $(shell find $(JAVA_BUILTINS_DIR) -name "*.java")
JAVA_MODELS_SOURCES = $(shell find $(JAVA_MODELS_DIR) -name "*.java")
JAVA_DEPS = $(addprefix $(PYTHON_LIB_DIR)/, \
analyze.py bucklib.py config.py issues.py jwlib.py source.py utils.py) \
$(addprefix $(CAPTURE_LIB_DIR)/, util.py) \
$(INFER_BIN) \
$(INFERANALYZE_BIN) \
$(INFERPRINT_BIN) \
$(JAVA_BUILTINS_SOURCES) \
$(JAVA_MODELS_SOURCES)
CLANG_DEPS = $(addprefix $(PYTHON_LIB_DIR)/, \
analyze.py config.py issues.py source.py utils.py) \
$(addprefix $(CAPTURE_LIB_DIR)/, make.py util.py) \
$(INFER_BIN) \
$(INFERANALYZE_BIN) \
$(INFERCLANG_BIN) \
$(INFERPRINT_BIN)
ANDROID_JAR = $(LIB_DIR)/java/android/android-23.jar
GUAVA_JAR = $(DEPENDENCIES_DIR)/java/guava/guava-10.0.1-fork.jar
INFER_ANNOTATIONS_JAR = $(ANNOTATIONS_DIR)/annotations.jar
JACKSON_JAR = $(DEPENDENCIES_DIR)/java/jackson/jackson-2.2.3.jar
JSR_305_JAR = $(DEPENDENCIES_DIR)/java/jsr-305/jsr305.jar
JAVA_MODELS_JAR = $(LIB_DIR)/java/models.jar
JAVA_DEPS_NO_MODELS = \
$(addprefix $(PYTHON_LIB_DIR)/, \
analyze.py bucklib.py config.py issues.py jwlib.py source.py utils.py) \
$(addprefix $(CAPTURE_LIB_DIR)/, util.py) \
$(ANDROID_JAR) $(GUAVA_JAR) $(JACKSON_JAR) $(JSR_305_JAR) $(INFER_ANNOTATIONS_JAR) \
$(INFER_BIN) $(INFERANALYZE_BIN) $(INFERPRINT_BIN)
JAVA_DEPS = $(JAVA_DEPS_NO_MODELS) $(JAVA_MODELS_JAR)
# markers to keep track of when clang models have been rebuilt
C_MODELS_FILE = $(SPECS_LIB_DIR)/c_models
CPP_MODELS_FILE = $(SPECS_LIB_DIR)/cpp_models
OBJC_MODELS_FILE = $(SPECS_LIB_DIR)/objc_models
CLANG_DEPS_NO_MODELS = \
$(addprefix $(PYTHON_LIB_DIR)/, \
analyze.py config.py issues.py source.py utils.py) \
$(addprefix $(CAPTURE_LIB_DIR)/, make.py util.py) \
$(INFER_BIN) $(INFERANALYZE_BIN) $(INFERCLANG_BIN) $(INFERPRINT_BIN)
CLANG_DEPS = $(CLANG_DEPS_NO_MODELS) $(C_MODELS_FILE) $(CPP_MODELS_FILE) \
$(shell find $(MODELS_DIR)/cpp/include -type f)
ifneq ($(XCODE_SELECT),no)
CLANG_DEPS += $(OBJC_MODELS_FILE)
endif
define silent_on_success
$(1) >/dev/null 2>/dev/null || ($(1) && exit 1)
endef

@ -8,14 +8,13 @@
ROOT_DIR = ../../..
include $(ROOT_DIR)/Makefile.config
C_MODELS_FILE = $(SPECS_LIB_DIR)/c_models
C_MODELS_SOURCES = $(shell find src/ -name "*.c")
INFER_RESULTS = out/report.json
all: install
$(INFER_RESULTS): $(C_MODELS_SOURCES) $(CLANG_DEPS)
# make clean in src/ in case $(CLANG_DEPS) have changed
$(INFER_RESULTS): $(C_MODELS_SOURCES) $(CLANG_DEPS_NO_MODELS)
# make clean in src/ to recompile all the models
$(call silent_on_success,\
$(INFER_BIN) -o $(@D) --models-mode --no-failures-allowed -- $(MAKE) -C src clean all)

@ -8,15 +8,14 @@
ROOT_DIR = ../../..
include $(ROOT_DIR)/Makefile.config
CPP_MODELS_FILE = $(SPECS_LIB_DIR)/cpp_models
CPP_MODELS_SOURCES = $(shell find src/ -name "*.cpp")
C_MODELS_SOURCES = $(shell find src/c_src/ -name "*.c")
INFER_RESULTS = out/report.json
all: install
$(INFER_RESULTS): $(CPP_MODELS_SOURCES) $(C_MODELS_SOURCES) $(CLANG_DEPS)
# make clean in src/ in case $(CLANG_DEPS) have changed
$(INFER_RESULTS): $(CPP_MODELS_SOURCES) $(C_MODELS_SOURCES) $(CLANG_DEPS_NO_MODELS)
# make clean in src/ to recompile all the models
$(call silent_on_success,\
$(INFER_BIN) -o $(@D) --models-mode --no-failures-allowed -- $(MAKE) -C src clean all)

@ -8,18 +8,12 @@
ROOT_DIR = ../../..
include $(ROOT_DIR)/Makefile.config
ANDROID_JAR = $(LIB_DIR)/java/android/android-23.jar
GUAVA_JAR = $(DEPENDENCIES_DIR)/java/guava/guava-10.0.1-fork.jar
INFER_ANNOTATIONS_JAR = $(ANNOTATIONS_DIR)/annotations.jar
JACKSON_JAR = $(DEPENDENCIES_DIR)/java/jackson/jackson-2.2.3.jar
JSR_305_JAR = $(DEPENDENCIES_DIR)/java/jsr-305/jsr305.jar
MODELS_OUT = models
INFER_RESULTS_DIR = $(MODELS_OUT)/infer
INFER_REPORT = $(INFER_RESULTS_DIR)/report.json
MODELS_JAR = models.jar
JAVA_SOURCES = $(JAVA_BUILTINS_SOURCES) $(JAVA_MODELS_SOURCES)
JAVA_SOURCES = $(shell find $(JAVA_BUILTINS_DIR) $(JAVA_MODELS_DIR) -name "*.java")
MODELS_CLASSPATH = $(ANDROID_JAR):$(GUAVA_JAR):$(JACKSON_JAR):$(JSR_305_JAR):$(INFER_ANNOTATIONS_JAR)
@ -33,7 +27,7 @@ clean:
compile:
javac -bootclasspath $(ANDROID_JAR) -d $(MODELS_OUT) -classpath $(MODELS_CLASSPATH) $(JAVA_SOURCES)
$(INFER_REPORT): $(ANDROID_JAR) $(GUAVA_JAR) $(JACKSON_JAR) $(JSR_305_JAR) $(INFER_ANNOTATIONS_JAR) $(JAVA_DEPS) $(JAVA_SOURCES)
$(INFER_REPORT): $(JAVA_DEPS_NO_MODELS) $(JAVA_SOURCES)
@rm -fr $(MODELS_OUT)
mkdir -p $(MODELS_OUT)
@rm -f $(JAVA_MODELS_JAR)

@ -8,14 +8,13 @@
ROOT_DIR = ../../..
include $(ROOT_DIR)/Makefile.config
OBJC_MODELS_FILE = $(SPECS_LIB_DIR)/objc_models
OBJC_MODELS_SOURCES = $(shell find src/ -name "*.m" -or -name "*.c")
INFER_RESULTS = out/report.json
all: install
$(INFER_RESULTS): $(OBJC_MODELS_SOURCES) $(CLANG_DEPS)
# make clean in src/ in case $(CLANG_DEPS) have changed
$(INFER_RESULTS): $(OBJC_MODELS_SOURCES) $(CLANG_DEPS_NO_MODELS)
# make clean in src/ to recompile all the models
$(call silent_on_success,\
$(INFER_BIN) -o $(@D) --models-mode --no-failures-allowed -- $(MAKE) -C src clean all)

Loading…
Cancel
Save