コード例 #1
0
ファイル: ant.py プロジェクト: RobinYin/infer
 def get_inferJ_commands(self, verbose_output):
     javac_pattern = '[javac]'
     argument_start_pattern = 'Compilation arguments'
     calls = []
     javac_arguments = []
     collect = False
     for line in verbose_output:
         if javac_pattern in line:
             if argument_start_pattern in line:
                 collect = True
                 if javac_arguments != []:
                     capture = util.create_inferJ_command(self.args,
                                                          javac_arguments)
                     calls.append(capture)
                     javac_arguments = []
             if collect:
                 pos = line.index(javac_pattern) + len(javac_pattern)
                 content = line[pos:].strip()
                 if self.is_interesting(content):
                     arg = self.remove_quotes(content)
                     javac_arguments.append(arg)
     if javac_arguments != []:
         capture = util.create_inferJ_command(self.args, javac_arguments)
         calls.append(capture)
         javac_arguments = []
     return calls
コード例 #2
0
 def get_inferJ_commands(self, verbose_output):
     javac_pattern = '[javac]'
     argument_start_pattern = 'Compilation arguments'
     calls = []
     javac_arguments = []
     collect = False
     for line in verbose_output:
         if javac_pattern in line:
             if argument_start_pattern in line:
                 collect = True
                 if javac_arguments != []:
                     capture = util.create_inferJ_command(
                         self.args, javac_arguments)
                     calls.append(capture)
                     javac_arguments = []
             if collect:
                 pos = line.index(javac_pattern) + len(javac_pattern)
                 content = line[pos:].strip()
                 if self.is_interesting(content):
                     arg = self.remove_quotes(content)
                     javac_arguments.append(arg)
     if javac_arguments != []:
         capture = util.create_inferJ_command(self.args, javac_arguments)
         calls.append(capture)
         javac_arguments = []
     return calls
コード例 #3
0
ファイル: gradle.py プロジェクト: DoctorQ/infer
 def get_inferJ_commands(self, verbose_output):
     argument_start_pattern = ' Compiler arguments: '
     calls = []
     for line in verbose_output:
         if argument_start_pattern in line:
             content = line.partition(argument_start_pattern)[2].strip()
             javac_arguments = content.split(' ')
             java_files = []
             java_args = []
             for java_arg in javac_arguments:
                 if java_arg.endswith('.java'):
                     java_files.append(java_arg)
                 else:
                     java_args.append(java_arg)
             with tempfile.NamedTemporaryFile(
                     mode='w',
                     suffix='.txt',
                     prefix='gradle_',
                     dir=os.path.join(self.args.infer_out, FILELISTS),
                     delete=False) as sources:
                 sources.write("\n".join(java_files))
                 sources.flush()
                 java_args.append("@" + sources.name)
                 capture = util.create_inferJ_command(self.args,
                                                      java_args)
                 calls.append(capture)
     return calls
コード例 #4
0
ファイル: gradle.py プロジェクト: imranali123/infer
 def get_inferJ_commands(self, verbose_output):
     argument_start_pattern = ' Compiler arguments: '
     calls = []
     seen_build_cmds = set([])
     for line in verbose_output:
         if argument_start_pattern in line:
             content = line.partition(argument_start_pattern)[2].strip()
             # if we're building both the debug and release configuration
             # and the build commands are identical up to "release/debug",
             # only do capture for one set of commands
             build_agnostic_cmd = content.replace('release', 'debug')
             if build_agnostic_cmd in seen_build_cmds:
                 continue
             seen_build_cmds.add(build_agnostic_cmd)
             javac_arguments = content.split(' ')
             java_files = []
             java_args = []
             for java_arg in javac_arguments:
                 if java_arg.endswith('.java'):
                     java_files.append(java_arg)
                 else:
                     java_args.append(java_arg)
             with tempfile.NamedTemporaryFile(
                     mode='w',
                     suffix='.txt',
                     prefix='gradle_',
                     dir=os.path.join(self.args.infer_out, jwlib.FILELISTS),
                     delete=False) as sources:
                 sources.write("\n".join(java_files))
                 sources.flush()
                 java_args.append("@" + sources.name)
                 capture = util.create_inferJ_command(self.args,
                                                      java_args)
                 calls.append(capture)
     return calls
コード例 #5
0
 def get_inferJ_commands(self, verbose_output):
     argument_start_pattern = ' Compiler arguments: '
     calls = []
     for line in verbose_output:
         if argument_start_pattern in line:
             content = line.partition(argument_start_pattern)[2].strip()
             javac_arguments = content.split(' ')
             java_files = []
             java_args = []
             for java_arg in javac_arguments:
                 if java_arg.endswith('.java'):
                     java_files.append(java_arg)
                 else:
                     java_args.append(java_arg)
             with tempfile.NamedTemporaryFile(mode='w',
                                              suffix='.txt',
                                              prefix='gradle_',
                                              dir=os.path.join(
                                                  self.args.infer_out,
                                                  jwlib.FILELISTS),
                                              delete=False) as sources:
                 sources.write("\n".join(java_files))
                 sources.flush()
                 java_args.append("@" + sources.name)
                 capture = util.create_inferJ_command(self.args, java_args)
                 calls.append(capture)
     return calls
コード例 #6
0
ファイル: mvn.py プロジェクト: zhouhui321/infer
    def get_inferJ_commands(self, verbose_output):
        file_pattern = r'\[DEBUG\] Stale source detected: ([^ ]*\.java)'
        options_pattern = '[DEBUG] Command line options:'

        files_to_compile = []
        calls = []
        options_next = False
        for line in verbose_output:
            if options_next:
                #  line has format [Debug] <space separated options>
                javac_args = line.split(' ')[1:] + files_to_compile
                capture = util.create_inferJ_command(self.args, javac_args)
                calls.append(capture)
                options_next = False
                files_to_compile = []

            elif options_pattern in line:
                #  Next line will have javac options to run
                options_next = True

            else:
                found = re.match(file_pattern, line)
                if found:
                    files_to_compile.append(found.group(1))

        return calls
コード例 #7
0
ファイル: mvn.py プロジェクト: DoctorQ/infer
    def get_inferJ_commands(self, verbose_output):
        file_pattern = r'\[DEBUG\] Stale source detected: ([^ ]*\.java)'
        options_pattern = '[DEBUG] Command line options:'

        files_to_compile = []
        calls = []
        options_next = False
        for line in verbose_output:
            if options_next:
                #  line has format [Debug] <space separated options>
                javac_args = line.split(' ')[1:] + files_to_compile
                capture = util.create_inferJ_command(self.args, javac_args)
                calls.append(capture)
                options_next = False
                files_to_compile = []

            elif options_pattern in line:
                #  Next line will have javac options to run
                options_next = True

            else:
                found = re.match(file_pattern, line)
                if found:
                    files_to_compile.append(found.group(1))

        return calls
コード例 #8
0
ファイル: gradle.py プロジェクト: 0x73/infer
 def get_inferJ_commands(self, verbose_output):
     argument_start_pattern = ' Compiler arguments: '
     calls = []
     for line in verbose_output:
         if argument_start_pattern in line:
             content = line.partition(argument_start_pattern)[2].strip()
             javac_arguments = content.split(' ')
             capture = util.create_inferJ_command(self.args,
                                                  javac_arguments)
             calls.append(capture)
     return calls
コード例 #9
0
ファイル: gradle.py プロジェクト: zhouhui321/infer
 def get_inferJ_commands(self, verbose_output):
     argument_start_pattern = ' Compiler arguments: '
     calls = []
     for line in verbose_output:
         if argument_start_pattern in line:
             content = line.partition(argument_start_pattern)[2].strip()
             javac_arguments = content.split(' ')
             capture = util.create_inferJ_command(self.args,
                                                  javac_arguments)
             calls.append(capture)
     return calls