コード例 #1
0
ファイル: gen_all.py プロジェクト: DotOS/android_development
def main():
    patt = re.compile('^.*\\.(?:' + '|'.join('(?:' + re.escape(ext) + ')'
                                             for ext in FILE_EXTENSIONS) +
                      ')$')
    input_dir_prefix_len = len(INPUT_DIR) + 1
    for base, dirnames, filenames in os.walk(INPUT_DIR):
        for filename in filenames:
            if not patt.match(filename):
                print('ignore:', filename)
                continue

            input_path = os.path.join(base, filename)
            input_rel_path = input_path[input_dir_prefix_len:]
            output_path = os.path.join(EXPECTED_DIR, input_rel_path)

            print('generating', output_path, '...')
            os.makedirs(os.path.dirname(output_path), exist_ok=True)
            run_header_abi_dumper(input_path,
                                  output_path,
                                  export_include_dirs=EXPORTED_HEADER_DIRS)

    modules = Module.get_test_modules()
    for module in modules:
        print('Created abi dump at', make_and_copy_reference_dumps(module))

    return 0
コード例 #2
0
ファイル: test.py プロジェクト: DotOS/android_development
 def run_and_compare(self, input_path, expected_path, cflags=[]):
     with open(expected_path, 'r') as f:
         expected_output = f.read()
     with tempfile.NamedTemporaryFile(dir=self.get_tmp_dir(),
                                      delete=False) as f:
         output_path = f.name
     run_header_abi_dumper(input_path, output_path, cflags,
                           EXPORTED_HEADER_DIRS)
     actual_output = _read_output_content(output_path)
     self.assertEqual(actual_output, expected_output)
コード例 #3
0
def main():
    patt = re.compile(
        '^.*\\.(?:' + \
        '|'.join('(?:' + re.escape(ext) + ')' for ext in FILE_EXTENSIONS) + \
        ')$')
    input_dir_prefix_len = len(INPUT_DIR) + 1
    for base, dirnames, filenames in os.walk(INPUT_DIR):
        for filename in filenames:
            if not patt.match(filename):
                print('ignore:', filename)
                continue

            input_path = os.path.join(base, filename)
            input_rel_path = input_path[input_dir_prefix_len:]
            output_path = os.path.join(EXPECTED_DIR, input_rel_path)

            print('generating', output_path, '...')
            output_content = run_header_abi_dumper(input_path, True,
                                                   DEFAULT_CFLAGS)

            os.makedirs(os.path.dirname(output_path), exist_ok=True)
            with open(output_path, 'w') as f:
                f.write(output_content)
    modules = Module.get_test_modules()
    for module in modules:
        make_and_copy_reference_dumps(module, DEFAULT_CFLAGS)

    return 0
コード例 #4
0
def main():
    patt = re.compile(
        '^.*\\.(?:' +
        '|'.join('(?:' + re.escape(ext) + ')' for ext in FILE_EXTENSIONS) +
        ')$')
    input_dir_prefix_len = len(INPUT_DIR) + 1
    for base, dirnames, filenames in os.walk(INPUT_DIR):
        for filename in filenames:
            if not patt.match(filename):
                print('ignore:', filename)
                continue

            input_path = os.path.join(base, filename)
            input_rel_path = input_path[input_dir_prefix_len:]
            output_path = os.path.join(EXPECTED_DIR, input_rel_path)

            print('generating', output_path, '...')
            output_content = run_header_abi_dumper(input_path)

            os.makedirs(os.path.dirname(output_path), exist_ok=True)
            with open(output_path, 'w') as f:
                f.write(output_content)
    modules = Module.get_test_modules()
    for module in modules:
        print('Created abi dump at', make_and_copy_reference_dumps(module))

    return 0
コード例 #5
0
 def make_dump(self, output_path):
     return run_header_abi_dumper(
         self.src,
         output_path,
         cflags=self.cflags,
         export_include_dirs=self.export_include_dirs,
         flags=self.dumper_flags)
コード例 #6
0
    def make_dump(self, output_path):
        """For each source file, produce a .sdump file, and link them to form
           an lsump file."""
        dumps_to_link = []
        with tempfile.TemporaryDirectory() as tmp:
            for src in self.srcs:
                sdump_path = os.path.join(tmp,
                                          os.path.basename(src) + '.sdump')
                dumps_to_link.append(sdump_path)
                run_header_abi_dumper(src, sdump_path,
                                      self.cflags + self.arch_cflags,
                                      self.export_include_dirs,
                                      self.dumper_flags)

            lsdump_path = os.path.join(tmp, self.get_dump_name())
            run_header_abi_linker(dumps_to_link, lsdump_path,
                                  self.version_script, self.api, self.arch,
                                  self.linker_flags)
            # Replace the absolute tmp paths in the type ID.
            with open(lsdump_path, 'r') as lsdump_file:
                content = lsdump_file.read().replace(tmp, '')

        with open(output_path, 'w') as output_file:
            output_file.write(content)
コード例 #7
0
 def make_dump(self):
     """For each source file, produce a .sdump file, and link them to form
        an lsump file."""
     dumps_to_link = []
     with tempfile.TemporaryDirectory() as tmp:
         output_lsdump = os.path.join(tmp, self.get_dump_name())
         for src in self.srcs:
             output_path = os.path.join(tmp,
                                        os.path.basename(src) + '.sdump')
             dumps_to_link.append(output_path)
             content = run_header_abi_dumper(src,
                                             self.cflags + self.arch_cflags,
                                             self.export_include_dirs,
                                             self.dumper_flags)
             with open(output_path, 'w') as dump_file:
                 dump_file.write(content)
         return run_header_abi_linker(output_lsdump,
                                      dumps_to_link,
                                      self.version_script,
                                      self.api,
                                      self.arch,
                                      self.linker_flags,
                                      input_dir=tmp)
コード例 #8
0
 def run_and_compare(self, input_path, expected_path, cflags=[]):
     with open(expected_path, 'r') as f:
         expected_output = f.read()
     actual_output = run_header_abi_dumper(input_path, cflags)
     self.assertEqual(actual_output, expected_output)
コード例 #9
0
def main():
    sys.stdout.write(run_header_abi_dumper(sys.argv[1], True, sys.argv[2:]))
    return 0
コード例 #10
0
ファイル: test.py プロジェクト: android/platform_development
 def run_and_compare(self, input_path, expected_path, cflags=[]):
     with open(expected_path, 'r') as f:
         expected_output = f.read()
     actual_output = run_header_abi_dumper(input_path, cflags)
     self.assertEqual(actual_output, expected_output)
コード例 #11
0
 def make_dump(self):
     return run_header_abi_dumper(
         self.src, cflags=self.cflags,
         export_include_dirs=self.export_include_dirs,
         flags=self.dumper_flags)
コード例 #12
0
def main():
    sys.stdout.write(run_header_abi_dumper(sys.argv[1], True, sys.argv[2:]))
    return 0
コード例 #13
0
ファイル: module.py プロジェクト: wuzhengu/android
 def make_dump(self, default_cflags):
     return run_header_abi_dumper(
         self.src, remove_absolute_paths=True, cflags=self.cflags,
         export_include_dirs=self.export_include_dirs,
         flags=self.dumper_flags)