コード例 #1
0
ファイル: build_mozc.py プロジェクト: hnakamur/mozc-deb
def CleanMain(options, unused_args):
  """The main function for the 'clean' command."""

  # File and directory names to be removed.
  file_names = []
  directory_names = []

  # Collect stuff in the gyp directories.
  gyp_directory_names = [os.path.dirname(f) for f in GetGypFileNames(options)]
  for gyp_directory_name in gyp_directory_names:
    if IsWindows():
      for pattern in ['*.ncb', '*.rules', '*.props', '*.sdf', '*.sln', '*.suo',
                      '*.targets', '*.vcproj', '*.vcproj.*.user', '*.vcxproj',
                      '*.vcxproj.filters', '*.vcxproj.user', 'gen_*_files.xml']:
        file_names.extend(glob.glob(os.path.join(gyp_directory_name,
                                                 pattern)))
      for build_type in ['Debug', 'Release']:
        directory_names.append(os.path.join(gyp_directory_name,
                                            build_type))
    elif IsMac():
      directory_names.extend(glob.glob(os.path.join(gyp_directory_name,
                                                    '*.xcodeproj')))

  # mozc_version.txt does not always exist.
  version_file = '%s/mozc_version.txt' % SRC_DIR
  if os.path.exists(version_file):
    file_names.append(version_file)
    build_base = GetBuildBaseName(GetMozcVersion().GetTargetPlatform())
    if build_base:
      directory_names.append(build_base)

  if IsLinux():
    # Remove auto-generated files.
    file_names.append(os.path.join(SRC_DIR, 'android', 'AndroidManifest.xml'))
    file_names.append(os.path.join(
        SRC_DIR, 'android', 'tests', 'AndroidManifest.xml'))
    # Remove a symbolic link to android/resources/res
    file_names.append(os.path.join(SRC_DIR, 'android', 'resources', 'res'))
    directory_names.append(os.path.join(SRC_DIR, 'android', 'assets'))
    # Delete files/dirs generated by Android SDK/NDK.
    android_library_projects = [
        '',
        'resources',
        'tests',
        ]
    android_generated_dirs = ['bin', 'gen', 'obj', 'libs', 'gen_for_adt']
    for project in android_library_projects:
      for directory in android_generated_dirs:
        directory_names.append(
            os.path.join(SRC_DIR, 'android', project, directory))

  # Remove files.
  for file_name in file_names:
    RemoveFile(file_name)
  # Remove directories.
  for directory_name in directory_names:
    RemoveDirectoryRecursively(directory_name)
コード例 #2
0
def RunTest(binary_path, output_dir, options):
  """Run test with options.

  Args:
    binary_path: The path of unittest.
    output_dir: The directory of output results.
    options: options to be passed to the unittest.
  """
  binary_filename = os.path.basename(binary_path)
  tmp_xml_path = os.path.join(output_dir, '%s.xml.running' % binary_filename)
  test_options = options[:]
  test_options.extend(['--gunit_output=xml:%s' % tmp_xml_path,
                       '--gtest_output=xml:%s' % tmp_xml_path])
  RunOrDie([binary_path] + test_options)

  xml_path = os.path.join(output_dir, '%s.xml' % binary_filename)
  CopyFile(tmp_xml_path, xml_path)
  RemoveFile(tmp_xml_path)
コード例 #3
0
def RunTestOnIos(binary_path, output_dir, _):
  """Run test with options.

  Args:
    binary_path: The path of unittest.
    output_dir: The directory of output results.
    _: Unused arg for the compatibility with RunTest.
  """
  iossim = '%s/third_party/iossim/iossim' % MOZC_ROOT
  binary_filename = os.path.basename(binary_path)
  tmp_xml_path = os.path.join(output_dir, '%s.xml.running' % binary_filename)
  env_options = [
      '-e', 'GUNIT_OUTPUT=xml:%s' % tmp_xml_path,
      '-e', 'GTEST_OUTPUT=xml:%s' % tmp_xml_path,
  ]
  RunOrDie([iossim] + env_options + [binary_path])

  xml_path = os.path.join(output_dir, '%s.xml' % binary_filename)
  CopyFile(tmp_xml_path, xml_path)
  RemoveFile(tmp_xml_path)
コード例 #4
0
ファイル: build_mozc.py プロジェクト: MShaffar19/mozc
def CleanMain(options, unused_args):
    """The main function for the 'clean' command."""

    # File and directory names to be removed.
    file_names = []
    directory_names = []

    # Collect stuff in the gyp directories.
    gyp_directory_names = [
        os.path.dirname(f) for f in GetGypFileNames(options)
    ]
    for gyp_directory_name in gyp_directory_names:
        if IsWindows():
            for pattern in [
                    '*.ncb', '*.rules', '*.props', '*.sdf', '*.sln', '*.suo',
                    '*.targets', '*.vcproj', '*.vcproj.*.user', '*.vcxproj',
                    '*.vcxproj.filters', '*.vcxproj.user', 'gen_*_files.xml'
            ]:
                file_names.extend(
                    glob.glob(os.path.join(gyp_directory_name, pattern)))
            for build_type in ['Debug', 'Release']:
                directory_names.append(
                    os.path.join(gyp_directory_name, build_type))
        elif IsMac():
            directory_names.extend(
                glob.glob(os.path.join(gyp_directory_name, '*.xcodeproj')))

    # mozc_version.txt does not always exist.
    version_file = '%s/mozc_version.txt' % SRC_DIR
    if os.path.exists(version_file):
        file_names.append(version_file)
        build_base = GetBuildBaseName(GetMozcVersion().GetTargetPlatform())
        if build_base:
            directory_names.append(build_base)

    # Remove files.
    for file_name in file_names:
        RemoveFile(file_name)
    # Remove directories.
    for directory_name in directory_names:
        RemoveDirectoryRecursively(directory_name)
コード例 #5
0
   """Build the target on Windows."""
@@ -1073,6 +1136,8 @@ def BuildMain(options, targets, original
     BuildOnMac(options, targets, original_directory_name)
   elif IsLinux():
     BuildOnLinux(options, targets, original_directory_name)
+  elif IsNetBSD():
+    BuildOnBSD(options, targets, original_directory_name)
   elif IsWindows():
     BuildOnWindows(targets)
   else:
@@ -1349,7 +1414,7 @@ def CleanBuildFilesAndDirectories(option
     elif IsMac():
       directory_names.extend(glob.glob(os.path.join(gyp_directory_name,
                                                     '*.xcodeproj')))
-    elif IsLinux():
+    elif IsLinux() or IsNetBSD():
       file_names.extend(glob.glob(os.path.join(gyp_directory_name,
                                                '*.target.mk')))
       file_names.extend(glob.glob(os.path.join(gyp_directory_name,
@@ -1397,6 +1462,10 @@ def CleanBuildFilesAndDirectories(option
 
   elif IsWindows():
     file_names.append('third_party/breakpad/breakpad.gyp')
+    directory_names.append('out_win')
+  elif IsNetBSD():
+    file_names.append('Makefile')
+    directory_names.append('out_bsd')
   # Remove files.
   for file_name in file_names:
     RemoveFile(file_name)