[infer][java] no longer fail on Buck Java project using a custom javac_jar compiler

Summary:
This makes sure that the javac_jar is disabled when setting the external compiler option to point at the Infer wrapper

Closes #976

Reviewed By: jvillard

Differential Revision: D9193336

fbshipit-source-id: abafb51fc
master
Jeremy Dubreil 6 years ago committed by Facebook Github Bot
parent 987ef9ef67
commit bdbb8242cf

@ -93,7 +93,7 @@ ifneq ($(ANT),no)
BUILD_SYSTEMS_TESTS += ant
endif
ifneq ($(BUCK),no)
BUILD_SYSTEMS_TESTS += buck genrule
BUILD_SYSTEMS_TESTS += buck genrule buck_javac_jar
# Introduce the dependency only if the two tests are going to be built in parallel, so that they do
# not run in parallel (otherwise Buck has a bad time). This works by checking if one of the main
# testing targets was passed as a goal on the command line.

@ -278,10 +278,13 @@ class Wrapper:
else:
self.timer.start('Running Buck ...')
buck_config = [
'--config', 'tools.javac=' + infer_script,
'--config', 'client.id=infer.java',
'--config', 'java.abi_generation_mode=class',
'--config', 'infer.no_custom_javac=true',
'--config', 'tools.javac=' + infer_script,
# make sure the javac_jar option is disabled to
# avoid conficts with the javac option
'--config', 'tools.javac_jar=',
]
buck_cmd = self.buck_cmd + buck_config
subprocess.check_call(buck_cmd)

@ -0,0 +1,2 @@
[tools]
javac_jar = /dev/null

@ -0,0 +1,27 @@
# Copyright (c) 2018-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
TESTS_DIR = ../..
ROOT_DIR = $(TESTS_DIR)/../..
ANALYZER = checkers
TARGET = //src:target
SOURCES = src/UsingJavacJar.java
OBJECTS = buck-out/gen/src/lib__target__output/target.jar
BUCKCONFIG = .buckconfig
INFER_OPTIONS = --eradicate-only
INFERPRINT_OPTIONS = --issues-tests
CLEAN_EXTRA = buck-out
include $(TESTS_DIR)/infer.make
$(OBJECTS): $(SOURCES) $(BUCKCONFIG)
$(BUCK) build --config tools.javac_jar= $(TARGET)
infer-out/report.json: $(SOURCES) $(BUCKCONFIG)
$(REMOVE_DIR) buck-out && \
$(call silent_on_success,Testing Buck Java integration with javac_jar,\
INFER_BIN=$(INFER_BIN) \
$(INFER_BIN) $(INFER_OPTIONS) -- $(BUCK) build $(TARGET))

@ -0,0 +1 @@
src/UsingJavacJar.java, Object UsingJavacJar.foo(), 0, ERADICATE_RETURN_NOT_NULLABLE, no_bucket, WARNING, [origin,Method `foo()` may return null but it is not annotated with `@Nullable`. (Origin: null constant at line 10)]

@ -0,0 +1,4 @@
java_library(
name = 'target',
srcs = glob(['*.java']),
)

@ -0,0 +1,12 @@
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
public class UsingJavacJar {
Object foo() {
return null;
}
}
Loading…
Cancel
Save