diff --git a/infer/lib/python/inferlib/jwlib.py b/infer/lib/python/inferlib/jwlib.py index b0b475f38..73fe1fff3 100644 --- a/infer/lib/python/inferlib/jwlib.py +++ b/infer/lib/python/inferlib/jwlib.py @@ -269,16 +269,6 @@ class AnalyzerWithFrontendWrapper(analyze.AnalyzerWrapper): if self.args.analyzer == config.ANALYZER_CAPTURE: return os.EX_OK - if self.args.buck: - if self.javac.args.classpath is not None: - infer_args = utils.read_env()['INFER_ARGS'] - # 'INFER_ARGS' must be CommandLineOption.args_env_var - for path in self.javac.args.classpath.split(os.pathsep): - if os.path.isfile(path): - infer_args += '^--specs-library^' + os.path.abspath(path) - # '^' must be CommandLineOption.env_var_sep - os.environ['INFER_ARGS'] = utils.encode(infer_args) - self.analyze_and_report() self._close() self.timing['total'] = utils.elapsed_time(start_time) diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index 90e22e078..eb3feb757 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -1246,13 +1246,23 @@ let rest = results_dir := classes_out_infer ) ) in + let classpath_spec = + Arg.String (fun classpath -> + if !buck then ( + let paths = String.split classpath ~on:':' in + let files = List.filter paths ~f:(fun path -> Sys.is_file path = `Yes) in + CLOpt.extend_env_args (List.concat_map files ~f:(fun file -> ["--specs-library"; file])) ; + specs_library := List.rev_append files !specs_library + ) + ) in CLOpt.mk_subcommand ~exes:CLOpt.[Toplevel] "Stop argument processing, use remaining arguments as a build command" (fun build_exe -> match Filename.basename build_exe with | "java" | "javac" -> [ - ("-classes_out", classes_out_spec, ""); ("-d", classes_out_spec, "") + ("-classes_out", classes_out_spec, ""); ("-d", classes_out_spec, ""); + ("-classpath", classpath_spec, ""); ("-cp", classpath_spec, "") ] | _ -> [] )