adding support for source roots in maven integration

Reviewed By: cristianoc

Differential Revision: D2885686

fb-gh-sync-id: c2a2e31
master
Sam Blackshear 9 years ago committed by facebook-github-bot-1
parent 262796d3bf
commit 82b1dd0572

@ -35,10 +35,12 @@ class MavenCapture:
def get_infer_commands(self, verbose_output): def get_infer_commands(self, verbose_output):
file_pattern = r'\[DEBUG\] Stale source detected: ([^ ]*\.java)' file_pattern = r'\[DEBUG\] Stale source detected: ([^ ]*\.java)'
options_pattern = '[DEBUG] Command line options:' options_pattern = '[DEBUG] Command line options:'
source_roots_pattern = '[DEBUG] Source roots:'
files_to_compile = [] files_to_compile = []
calls = [] calls = []
options_next = False options_next = False
source_roots_next = False
for line in verbose_output: for line in verbose_output:
if options_next: if options_next:
# line has format [Debug] <space separated options> # line has format [Debug] <space separated options>
@ -48,10 +50,23 @@ class MavenCapture:
options_next = False options_next = False
files_to_compile = [] files_to_compile = []
elif source_roots_next:
# line has format [Debug] <space separated directories>
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: elif options_pattern in line:
# Next line will have javac options to run # Next line will have javac options to run
options_next = True options_next = True
elif source_roots_pattern in line:
# Next line will have directory containing files to compile
source_roots_next = True
else: else:
found = re.match(file_pattern, line) found = re.match(file_pattern, line)
if found: if found:

Loading…
Cancel
Save