diff --git a/infer/lib/python/inferlib/capture/mvn.py b/infer/lib/python/inferlib/capture/mvn.py index 309c099f9..a330a2f26 100644 --- a/infer/lib/python/inferlib/capture/mvn.py +++ b/infer/lib/python/inferlib/capture/mvn.py @@ -35,10 +35,12 @@ class MavenCapture: def get_infer_commands(self, verbose_output): file_pattern = r'\[DEBUG\] Stale source detected: ([^ ]*\.java)' options_pattern = '[DEBUG] Command line options:' + source_roots_pattern = '[DEBUG] Source roots:' files_to_compile = [] calls = [] options_next = False + source_roots_next = False for line in verbose_output: if options_next: # line has format [Debug] @@ -48,10 +50,23 @@ class MavenCapture: options_next = False files_to_compile = [] + elif source_roots_next: + # line has format [Debug] + src_roots = line.split(' ')[1:] + for src_root in src_roots: + for root, dirs, files in os.walk(src_root): + for name in files: + files_to_compile.append(os.path.join(root, name)) + source_roots_next = False + elif options_pattern in line: # Next line will have javac options to run options_next = True + elif source_roots_pattern in line: + # Next line will have directory containing files to compile + source_roots_next = True + else: found = re.match(file_pattern, line) if found: