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)
def AddTargetPlatformOption(parser): if IsLinux(): default_target = 'Linux' elif IsWindows(): default_target = 'Windows' elif IsMac(): default_target = 'Mac' parser.add_option('--target_platform', dest='target_platform', default=default_target, help=('This option enables this script to know which build' 'should be done.'))
def AddTargetPlatformOption(parser): # Linux environment can build for Linux, Android and NaCl. # --target_platform option enables this script to know which build # should be done. If you want NaCl build, specify "NaCl". # If you want Android build, specify "Android". if IsLinux(): default_target = 'Linux' elif IsWindows(): default_target = 'Windows' elif IsMac(): default_target = 'Mac' parser.add_option('--target_platform', dest='target_platform', default=default_target, help=('Linux environment can build for Linux, Android and ' 'NaCl. This option enables this script to know ' 'which build should be done. ' 'If you want Android build, specify "Android". ' 'If you want NaCl build, specify "NaCl".'))
logging.info('removing ibus.gyp.') gyp_file_names.remove('%s/unix/ibus/ibus.gyp' % SRC_DIR) + elif options.target_platform == 'NetBSD': + gyp_file_names.extend(glob.glob('%s/unix/*/*.gyp' % SRC_DIR)) + # Add ibus.gyp if ibus version is >=1.4.1. + if not PkgExists('ibus-1.0 >= 1.4.1'): + logging.info('removing ibus.gyp.') + gyp_file_names.remove('%s/unix/ibus/ibus.gyp' % SRC_DIR) + elif options.target_platform == 'ChromeOS': + gyp_file_names.extend(glob.glob('%s/unix/ibus/*.gyp' % SRC_DIR)) elif options.target_platform == 'NaCl': # Add chrome NaCl Mozc gyp scripts. gyp_file_names.append('%s/chrome/nacl/nacl_extension.gyp' % SRC_DIR) @@ -314,6 +325,8 @@ def AddTargetPlatformOption(parser): # If you want Android build, specify "Android". if IsLinux(): default_target = 'Linux' + elif IsNetBSD(): + default_target = 'NetBSD' elif IsWindows(): default_target = 'Windows' elif IsMac(): @@ -511,6 +524,14 @@ def ExpandMetaTarget(options, meta_targe SRC_DIR + '/gui/gui.gyp:mozc_tool'] if PkgExists('ibus-1.0 >= 1.4.1'): targets.append(SRC_DIR + '/unix/ibus/ibus.gyp:ibus_mozc') + elif target_platform == 'NetBSD': + targets = [SRC_DIR + '/server/server.gyp:mozc_server', + SRC_DIR + '/renderer/renderer.gyp:mozc_renderer', + SRC_DIR + '/gui/gui.gyp:mozc_tool'] + if PkgExists('ibus-1.0 >= 1.4.1'):
def AddTargetPlatformOption(parser): if IsLinux(): default_target = 'Linux'