1
- from collections import defaultdict
2
1
import re
3
2
import os
4
3
@@ -13,10 +12,9 @@ class GroovyCompiler(BaseCompiler):
13
12
14
13
STACKOVERFLOW_REGEX = re .compile (r'(.*java.lang.StackOverflowError)(.*)' )
15
14
16
- def __init__ (self , input_name ):
15
+ def __init__ (self , input_name , filter_patterns = None ):
17
16
input_name = os .path .join (input_name , '*' , '*.groovy' )
18
- super ().__init__ (input_name )
19
- self .crash_msg = None
17
+ super ().__init__ (input_name , filter_patterns )
20
18
21
19
@classmethod
22
20
def get_compiler_version (cls ):
@@ -25,23 +23,17 @@ def get_compiler_version(cls):
25
23
def get_compiler_cmd (self ):
26
24
return ['groovyc' , '--compile-static' , self .input_name ]
27
25
28
- def analyze_compiler_output (self , output ):
29
- self .crashed = None
30
- failed = defaultdict (list )
31
- matches = re .findall (self .ERROR_REGEX , output )
32
- for match in matches :
33
- filename = match [0 ]
34
- error_msg = match [1 ]
35
- failed [filename ].append (error_msg )
36
-
37
- crash_match = re .search (self .CRASH_REGEX , output )
38
- if crash_match and not matches :
39
- self .crash_msg = output
40
- return None
26
+ def get_filename (self , match ):
27
+ return match [0 ]
41
28
29
+ def get_error_msg (self , match ):
30
+ return match [1 ]
31
+
32
+ def analyze_compiler_output (self , output ):
33
+ failed , matches = super ().analyze_compiler_output (output )
42
34
stack_overflow = re .search (self .STACKOVERFLOW_REGEX , output )
43
35
if stack_overflow and not matches :
44
36
self .crash_msg = output
45
- return None
37
+ return None , matches
46
38
47
- return failed
39
+ return failed , matches
0 commit comments