facebook / facebook/infer

Infer assumes gradle will use system's javac

Open
#992 0 comments 3 reactions 0 assignees View on GitHub
pinned
Dominant language
OCaml
Stars
15.7k
Forks
2.1k
Avg merge
19h 36m
Merged PRs (30d)
13

Description

I am using infer 0.15.0 on Ubuntu 18.

I have a java project that builds using gradle, and which is configured to use the [gradle ErrorProne compiler plugin](https://github.com/tbroyer/gradle-errorprone-plugin). In `build.gradle`, I've configure java compilations to use an ErrorProne-specific java flag, `-XepAllErrorsAsWarnings`, as describe in the link above.

Running infer on my project fails as follow (project name and details elided):

```
> infer capture -- ./gradlew all
...
lots of files compile
...
Usage Error:
*** Failed to execute compilation command: exited with code 2
*** Command: javac '@/infer-out/filelists/gradle_pXRP9K.txt' '@/tmp/args_.tmp.046d5a'
*** Output:
javac: invalid flag: -XepAllErrorsAsWarnings
Usage: javac
use -help for a list of possible options

*** Infer needs a working compilation command to run.

Failed to execute: /opt/infer-linux64-v0.15.0/lib/infer/infer/lib/python/inferlib/../../../bin/infer capture --continue -- javac
```

It seems like infer is incorrectly assuming that `gradle` uses the same `javac` as the one on my `$PATH`, or at least that the same command-line arguments will be accepted by gradle's compiler and vanilla `javac`. That's not true in my case, because gradle is using the ErrorProne java compiler and passing a non-standard argument to it.

This problem looks like a near-duplicate of issue #890. #890 (and several other issues) were originally closed as duplicates of #855, all dealing generally with infer having flaky integration with gradle. However, #855 was later closed with a specific fix that does not address the present issue. So I don't believe this problem is covered by any currently-open issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.