def Main(): if HOST_OS != 'linux': print 'Debian build only supported on linux' return -1 options, args = BuildOptions().parse_args() out_dir = options.out_dir tar_filename = options.tar_filename if not options.out_dir: out_dir = join(DART_DIR, utils.GetBuildDir(HOST_OS, HOST_OS)) if not tar_filename: tar_filename = join(DART_DIR, utils.GetBuildDir(HOST_OS, HOST_OS), 'dart-%s.tar.gz' % utils.GetVersion()) BuildDebianPackage(tar_filename, out_dir)
def main(): parser = optparse.OptionParser() parser.add_option('--parallel', dest='parallel', action='store_true', default=False, help='Use fremontcut in parallel mode.') parser.add_option('--rebuild', dest='rebuild', action='store_true', default=False, help='Rebuild the database from IDL using fremontcut.') parser.add_option('--systems', dest='systems', action='store', type='string', default='htmldart2js,htmldartium', help='Systems to generate (htmldart2js, htmldartium)') parser.add_option('--output-dir', dest='output_dir', action='store', type='string', default=None, help='Directory to put the generated files') parser.add_option('--use-database-cache', dest='use_database_cache', action='store_true', default=False, help='''Use the cached database from the previous run to improve startup performance''') (options, args) = parser.parse_args() current_dir = os.path.dirname(__file__) database_dir = os.path.join(current_dir, '..', 'database') logging.config.fileConfig(os.path.join(current_dir, 'logging.conf')) systems = options.systems.split(',') output_dir = options.output_dir or os.path.join( current_dir, '..', '..', utils.GetBuildDir(utils.GuessOS(), None), 'generated') dart2js_output_dir = None if 'htmldart2js' in systems: dart2js_output_dir = os.path.join(output_dir, 'dart2js') dartium_output_dir = None if 'htmldartium' in systems: dartium_output_dir = os.path.join(output_dir, 'dartium') if options.rebuild: # Parse the IDL and create the database. database = fremontcutbuilder.main(options.parallel) else: # Load the previously generated database. database = LoadDatabase(database_dir, options.use_database_cache) GenerateFromDatabase(database, dart2js_output_dir, dartium_output_dir) if 'htmldart2js' in systems: _logger.info('Generating dart2js single files.') for library_name in HTML_LIBRARY_NAMES: GenerateSingleFile( os.path.join(dart2js_output_dir, '%s_dart2js.dart' % library_name), os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dart2js')) if 'htmldartium' in systems: _logger.info('Generating dartium single files.') for library_name in HTML_LIBRARY_NAMES: GenerateSingleFile( os.path.join(dartium_output_dir, '%s_dartium.dart' % library_name), os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dartium'))
def Main(): if HOST_OS != 'linux': print('Debian build only supported on linux') return -1 options, args = BuildOptions().parse_args() out_dir = options.out_dir tar_filename = options.tar_filename if options.arch == 'all': options.arch = 'ia32,x64,armhf' arch = options.arch.split(',') if not options.out_dir: out_dir = join(DART_DIR, utils.GetBuildDir(HOST_OS)) if not tar_filename: tar_filename = join(DART_DIR, utils.GetBuildDir(HOST_OS), 'dart-%s.tar.gz' % utils.GetVersion()) BuildDebianPackage(tar_filename, out_dir, arch, options.toolchain)
def GenerateBuildfilesIfNeeded(): if os.path.exists(utils.GetBuildDir(HOST_OS)): return True command = [ 'python', os.path.join(DART_ROOT, 'tools', 'generate_buildfiles.py') ] print("Running " + ' '.join(command)) process = subprocess.Popen(command) process.wait() if process.returncode != 0: print("Tried to generate missing buildfiles, but failed. " "Try running manually:\n\t$ " + ' '.join(command)) return False return True
def Main(): if HOST_OS != 'linux': print 'Tarball can only be created on linux' return -1 # Parse the options. parser = BuildOptions() (options, args) = parser.parse_args() if options.verbose: global verbose verbose = True tar_filename = options.tar_filename if not tar_filename: tar_filename = join(FLETCH_DIR, utils.GetBuildDir(HOST_OS), 'fletch-%s.tar.gz' % utils.GetVersion()) CreateTarball(tar_filename)
def CreateTarball(tarfilename): global ignoredPaths # Used for adding the output directory. # Generate the name of the tarfile version = utils.GetVersion() global versiondir versiondir = 'dart-%s' % version debian_dir = 'tools/linux_dist_support/debian' # Don't include the build directory in the tarball (ignored paths # are relative to DART_DIR). builddir = utils.GetBuildDir(HOST_OS) ignoredPaths.append(builddir) print 'Creating tarball: %s' % tarfilename with tarfile.open(tarfilename, mode='w:gz') as tar: for f in listdir(DART_DIR): tar.add(join(DART_DIR, f), filter=Filter) for f in listdir(join(DART_DIR, debian_dir)): tar.add(join(DART_DIR, debian_dir, f), arcname='%s/debian/%s' % (versiondir, f)) with utils.TempDir() as temp_dir: # Generate and add debian/copyright copyright_file = join(temp_dir, 'copyright') GenerateCopyright(copyright_file) tar.add(copyright_file, arcname='%s/debian/copyright' % versiondir) # Generate and add debian/changelog change_log = join(temp_dir, 'changelog') GenerateChangeLog(change_log, version) tar.add(change_log, arcname='%s/debian/changelog' % versiondir) # For generated version file build dependency, add fake git reflog. empty = join(temp_dir, 'empty') GenerateEmpty(empty) tar.add(empty, arcname='%s/dart/.git/logs/HEAD' % versiondir) # For bleeding_edge add the GIT_REVISION file. if utils.GetChannel() == 'be': git_revision = join(temp_dir, 'GIT_REVISION') GenerateGitRevision(git_revision, utils.GetGitRevision()) tar.add(git_revision, arcname='%s/dart/tools/GIT_REVISION' % versiondir)
def CreateTarball(tarfilename): global ignoredPaths # Used for adding the output directory. # Generate the name of the tarfile version = utils.GetVersion() global versiondir versiondir = 'dartino-%s' % version debian_dir = 'tools/linux_dist_support/debian' # Don't include the build directory in the tarball (ignored paths # are relative to DARTINO_DIR). builddir = utils.GetBuildDir(HOST_OS) ignoredPaths.append(builddir) print 'Creating tarball: %s' % tarfilename with tarfile.open(tarfilename, mode='w:gz') as tar: for f in listdir(DARTINO_DIR): tar.add(join(DARTINO_DIR, f), filter=Filter) for f in listdir(join(DARTINO_DIR, debian_dir)): tar.add(join(DARTINO_DIR, debian_dir, f), arcname='%s/debian/%s' % (versiondir, f)) tar.add(join(DARTINO_DIR, 'platforms/raspberry-pi2/data/dartino-agent'), arcname='%s/debian/dartino-agent.init' % versiondir) tar.add(join(DARTINO_DIR, 'platforms/raspberry-pi2/data/dartino-agent.env'), arcname='%s/debian/dartino-agent.default' % versiondir) with utils.TempDir() as temp_dir: # Generate and add debian/copyright copyright_file = join(temp_dir, 'copyright') GenerateCopyright(copyright_file) tar.add(copyright_file, arcname='%s/debian/copyright' % versiondir) # Generate and add debian/changelog change_log = join(temp_dir, 'changelog') GenerateChangeLog(change_log, version) tar.add(change_log, arcname='%s/debian/changelog' % versiondir) # Add the GIT_REVISION file. git_revision = join(temp_dir, 'GIT_REVISION') GenerateGitRevision(git_revision, utils.GetGitRevision()) tar.add(git_revision, arcname='%s/sdk/tools/GIT_REVISION' % versiondir)
def CreateTarball(tarfilename): global ignoredPaths # Used for adding the output directory. # Generate the name of the tarfile version = utils.GetVersion() global versiondir versiondir = 'dart-%s' % version debian_dir = 'tools/linux_dist_support/debian' # Don't include the build directory in the tarball (ignored paths # are relative to DART_DIR). builddir = utils.GetBuildDir(HOST_OS, HOST_OS) ignoredPaths.append(builddir) print 'Creating tarball: %s' % tarfilename with tarfile.open(tarfilename, mode='w:gz') as tar: for f in listdir(DART_DIR): tar.add(join(DART_DIR, f), filter=Filter) for f in listdir(join(DART_DIR, debian_dir)): tar.add(join(DART_DIR, debian_dir, f), arcname='%s/debian/%s' % (versiondir, f)) with utils.TempDir() as temp_dir: # Generate and add debian/copyright copyright = join(temp_dir, 'copyright') GenerateCopyright(copyright) tar.add(copyright, arcname='%s/debian/copyright' % versiondir) # Generate and add debian/changelog change_log = join(temp_dir, 'changelog') GenerateChangeLog(change_log, version) tar.add(change_log, arcname='%s/debian/changelog' % versiondir) # For bleeding_edge add the SVN_REVISION file. if utils.GetChannel() == 'be': svn_revision = join(temp_dir, 'SVN_REVISION') GenerateSvnRevision(svn_revision, utils.GetSVNRevision()) tar.add(svn_revision, arcname='%s/dart/tools/SVN_REVISION' % versiondir)
def Main(): utils.ConfigureJava() # Parse the options. parser = BuildOptions() (options, args) = parser.parse_args() if not ProcessOptions(options, args): parser.print_help() return 1 # Determine which targets to build. By default we build the "all" target. if len(args) == 0: if HOST_OS == 'macos': targets = ['All'] else: targets = ['samples'] else: targets = args filter_xcodebuild_output = False # Remember path old_path = os.environ['PATH'] # Build all targets for each requested configuration. for target in targets: for target_os in options.os: for mode in options.mode: for arch in options.arch: os.environ['DART_BUILD_MODE'] = mode build_config = utils.GetBuildConf(mode, arch) if HOST_OS == 'macos': filter_xcodebuild_output = True project_file = 'dart.xcodeproj' if os.path.exists('dart-%s.gyp' % CurrentDirectoryBaseName()): project_file = 'dart-%s.xcodeproj' % CurrentDirectoryBaseName( ) args = [ 'xcodebuild', '-project', project_file, '-target', target, '-configuration', build_config, 'SYMROOT=%s' % os.path.abspath('xcodebuild') ] elif HOST_OS == 'win32': project_file = 'dart.sln' if os.path.exists('dart-%s.gyp' % CurrentDirectoryBaseName()): project_file = 'dart-%s.sln' % CurrentDirectoryBaseName( ) if target == 'all': args = [ options.devenv + os.sep + options.executable, '/build', build_config, project_file ] else: args = [ options.devenv + os.sep + options.executable, '/build', build_config, '/project', target, project_file ] else: make = 'make' if HOST_OS == 'freebsd': make = 'gmake' # work around lack of flock os.environ['LINK'] = '$(CXX)' args = [ make, '-j', options.j, 'BUILDTYPE=' + build_config, ] if target_os != HOST_OS: args += [ 'builddir_name=' + utils.GetBuildDir(HOST_OS, target_os) ] if options.verbose: args += ['V=1'] args += [target] if target_os != HOST_OS: SetCrossCompilationEnvironment(HOST_OS, target_os, arch, old_path) else: gypDefinesList = ['target_arch=%s' % arch] os.environ['GYP_DEFINES'] = ' '.join(gypDefinesList) RunhooksIfNeeded(HOST_OS, mode, arch, target_os) toolchainprefix = None if target_os == 'android': if arch == 'ia32': toolchainprefix = ('%s/i686-linux-android' % os.environ['ANDROID_TOOLCHAIN']) if arch == 'arm': toolchainprefix = ('%s/arm-linux-androideabi' % os.environ['ANDROID_TOOLCHAIN']) sysroot = os.environ[ 'ANDROID_NDK_ROOT'] + "/platforms/android-19/arch-arm" args.append("CFLAGS=--sysroot=" + sysroot) args.append( "CXXFLAGS=-Ithird_party/dart/third_party/android_tools/ndk/sources/cxx-stl/stlport/stlport/ --sysroot=" + sysroot) args.append("LDFLAGS=--sysroot=" + sysroot) toolsOverride = SetTools(arch, toolchainprefix) if toolsOverride: printToolOverrides = target_os != 'android' for k, v in toolsOverride.iteritems(): args.append(k + "=" + v) if printToolOverrides: print k + " = " + v if not os.path.isfile(toolsOverride['CC.target']): if arch == 'arm': print arm_cc_error else: print "Couldn't find compiler: %s" % toolsOverride[ 'CC.target'] return 1 process = None if filter_xcodebuild_output: process = subprocess.Popen( args, stdin=None, bufsize=1, # Line buffered. stdout=subprocess.PIPE, stderr=subprocess.STDOUT) FilterEmptyXcodebuildSections(process) else: process = subprocess.Popen(args, stdin=None) process.wait() if process.returncode != 0: print "BUILD FAILED" return 1 return 0
def BuildOneConfig(options, target, target_os, mode, arch, override_tools): global filter_xcodebuild_output start_time = time.time() args = [] build_config = utils.GetBuildConf(mode, arch, target_os) if not options.gyp: args = BuildNinjaCommand(options, target, target_os, mode, arch) else: os.environ['DART_BUILD_MODE'] = mode if HOST_OS == 'macos': filter_xcodebuild_output = True project_file = 'dart.xcodeproj' if os.path.exists('dart-%s.gyp' % CurrentDirectoryBaseName()): project_file = 'dart-%s.xcodeproj' % CurrentDirectoryBaseName() if target == 'all': target = 'All' args = ['xcodebuild', '-project', project_file, '-target', target, '-configuration', build_config, 'SYMROOT=%s' % os.path.abspath('xcodebuild') ] elif HOST_OS == 'win32': project_file = 'dart.sln' if os.path.exists('dart-%s.gyp' % CurrentDirectoryBaseName()): project_file = 'dart-%s.sln' % CurrentDirectoryBaseName() # Select a platform suffix to pass to devenv. if arch == 'ia32': platform_suffix = 'Win32' elif arch == 'x64': platform_suffix = 'x64' else: print 'Unsupported arch for MSVC build: %s' % arch return 1 config_name = '%s|%s' % (build_config, platform_suffix) if target == 'all': args = [options.devenv + os.sep + options.executable, '/build', config_name, project_file ] else: args = [options.devenv + os.sep + options.executable, '/build', config_name, '/project', target, project_file ] else: make = 'make' if HOST_OS == 'freebsd': make = 'gmake' # work around lack of flock os.environ['LINK'] = '$(CXX)' args = [make, '-j', options.j, 'BUILDTYPE=' + build_config, ] if target_os != HOST_OS: args += ['builddir_name=' + utils.GetBuildDir(HOST_OS)] if options.verbose: args += ['V=1'] args += [target] toolsOverride = None if override_tools: toolsOverride = SetTools(arch, target_os, options) if toolsOverride: for k, v in toolsOverride.iteritems(): args.append( k + "=" + v) if options.verbose: print k + " = " + v if not os.path.isfile(toolsOverride['CC.target']): if arch == 'arm': print arm_cc_error else: print "Couldn't find compiler: %s" % toolsOverride['CC.target'] return 1 print ' '.join(args) process = None if filter_xcodebuild_output: process = subprocess.Popen(args, stdin=None, bufsize=1, # Line buffered. stdout=subprocess.PIPE, stderr=subprocess.STDOUT) FilterEmptyXcodebuildSections(process) else: process = subprocess.Popen(args, stdin=None) process.wait() if process.returncode != 0: NotifyBuildDone(build_config, success=False, start=start_time) return 1 else: NotifyBuildDone(build_config, success=True, start=start_time) return 0
def main(): parser = optparse.OptionParser() parser.add_option( '--parallel', dest='parallel', action='store_true', default=False, help='Use fremontcut in parallel mode.') parser.add_option( '--systems', dest='systems', action='store', type='string', default='htmldart2js,htmldartium,_blink', help='Systems to generate (htmldart2js, htmldartium, _blink)') parser.add_option( '--output-dir', dest='output_dir', action='store', type='string', default=None, help='Directory to put the generated files') parser.add_option( '--nnbd', dest='nnbd', action='store_true', default=False, help='Generate code with non-nullability annotations') parser.add_option( '--use-database-cache', dest='use_database_cache', action='store_true', default=False, help='''Use the cached database from the previous run to improve startup performance''') parser.add_option( '--update-dom-metadata', dest='update_dom_metadata', action='store_true', default=False, help='''Update the metadata list of DOM APIs''') parser.add_option( '--verbose', dest='logging_level', action='store_false', default=logging.WARNING, help='Output all informational messages') parser.add_option( '--examine', dest='examine_idls', action='store_true', default=None, help='Analyze IDL files') parser.add_option( '--logging', dest='logging', type='int', action='store', default=logging.NOTSET, help='Level of logging 20 is Info, 30 is Warnings, 40 is Errors') parser.add_option( '--gen-interop', dest='dart_js_interop', action='store_true', default=False, help='Use Javascript objects (dart:js) accessing the DOM in _blink') parser.add_option( '--no-cached-patches', dest='no_cached_patches', action='store_true', default=False, help='Do not generate the sdk/lib/js/cached_patches.dart file') (options, args) = parser.parse_args() current_dir = os.path.dirname(__file__) database_dir = os.path.join(current_dir, '..', 'database') logging.config.fileConfig(os.path.join(current_dir, 'logging.conf')) systems = options.systems.split(',') output_dir = options.output_dir or os.path.join( current_dir, '..', '..', '..', utils.GetBuildDir(utils.GuessOS()), 'generated') dart2js_output_dir = None if 'htmldart2js' in systems: dart2js_output_dir = os.path.join(output_dir, 'dart2js') logging_level = options.logging_level \ if options.logging == logging.NOTSET else options.logging start_time = time.time() UpdateCssProperties() # Parse the IDL and create the database. database = fremontcutbuilder.main( options.parallel, logging_level=logging_level, examine_idls=options.examine_idls) GenerateFromDatabase(database, dart2js_output_dir, options.update_dom_metadata, logging_level, options.dart_js_interop, options.nnbd) file_generation_start_time = time.time() if 'htmldart2js' in systems: _logger.info('Generating dart2js single files.') for library_name in HTML_LIBRARY_NAMES: source = os.path.join(dart2js_output_dir, '%s_dart2js.dart' % library_name) GenerateSingleFile( source, os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dart2js')) print '\nGenerating single file %s seconds' % round( time.time() - file_generation_start_time, 2) end_time = time.time() print '\nDone (dartdomgenerator) %s seconds' % round( end_time - start_time, 2)
def main(): parser = optparse.OptionParser() parser.add_option('--parallel', dest='parallel', action='store_true', default=False, help='Use fremontcut in parallel mode.') parser.add_option('--rebuild', dest='rebuild', action='store_true', default=False, help='Rebuild the database from IDL using fremontcut.') parser.add_option('--systems', dest='systems', action='store', type='string', default='htmldart2js,htmldartium', help='Systems to generate (htmldart2js, htmldartium)') parser.add_option('--output-dir', dest='output_dir', action='store', type='string', default=None, help='Directory to put the generated files') parser.add_option('--use-database-cache', dest='use_database_cache', action='store_true', default=False, help='''Use the cached database from the previous run to improve startup performance''') parser.add_option('--update-dom-metadata', dest='update_dom_metadata', action='store_true', default=False, help='''Update the metadata list of DOM APIs''') parser.add_option('--blink-parser', dest='blink_parser', action='store_true', default=False, help='Use New Blink IDL parser.') parser.add_option('--verbose', dest='logging_level', action='store_false', default=logging.WARNING, help='Output all informational messages') parser.add_option( '--logging', dest='logging', type='int', action='store', default=logging.NOTSET, help='Level of logging 20 is Info, 30 is Warnings, 40 is Errors') (options, args) = parser.parse_args() current_dir = os.path.dirname(__file__) database_dir = os.path.join(current_dir, '..', 'database') logging.config.fileConfig(os.path.join(current_dir, 'logging.conf')) systems = options.systems.split(',') output_dir = options.output_dir or os.path.join( current_dir, '..', '..', utils.GetBuildDir(utils.GuessOS()), 'generated') dart2js_output_dir = None if 'htmldart2js' in systems: dart2js_output_dir = os.path.join(output_dir, 'dart2js') dartium_output_dir = None if 'htmldartium' in systems: dartium_output_dir = os.path.join(output_dir, 'dartium') logging_level = options.logging_level \ if options.logging == logging.NOTSET else options.logging start_time = time.time() UpdateCssProperties() if options.rebuild: # Parse the IDL and create the database. database = fremontcutbuilder.main(options.parallel, options.blink_parser, logging_level=logging_level) else: # TODO(terry): Should be able to remove this... # Load the previously generated database. if not options.blink_parser: database = LoadDatabase(database_dir, options.use_database_cache) GenerateFromDatabase(database, dart2js_output_dir, dartium_output_dir, options.update_dom_metadata, logging_level) file_generation_start_time = time.time() if 'htmldart2js' in systems: _logger.info('Generating dart2js single files.') for library_name in HTML_LIBRARY_NAMES: GenerateSingleFile( os.path.join(dart2js_output_dir, '%s_dart2js.dart' % library_name), os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dart2js')) if 'htmldartium' in systems: _logger.info('Generating dartium single files.') file_generation_start_time = time.time() for library_name in HTML_LIBRARY_NAMES: GenerateSingleFile( os.path.join(dartium_output_dir, '%s_dartium.dart' % library_name), os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dartium')) GenerateSingleFile( os.path.join(dartium_output_dir, '_blink_dartium.dart'), os.path.join('..', '..', '..', 'sdk', 'lib', '_blink', 'dartium')) print '\nGenerating single file %s seconds' % round( time.time() - file_generation_start_time, 2) end_time = time.time() print '\nDone (dartdomgenerator) %s seconds' % round( end_time - start_time, 2)
def Main(): utils.ConfigureJava() # Parse the options. parser = BuildOptions() (options, args) = parser.parse_args() if not ProcessOptions(options, args): parser.print_help() return 1 # Determine which targets to build. By default we build the "all" target. if len(args) == 0: if HOST_OS == 'macos': targets = ['All'] else: targets = ['all'] else: targets = args filter_xcodebuild_output = False # Build all targets for each requested configuration. for target in targets: for target_os in options.os: for mode in options.mode: for arch in options.arch: start_time = time.time() os.environ['DART_BUILD_MODE'] = mode build_config = utils.GetBuildConf(mode, arch, target_os) if HOST_OS == 'macos': filter_xcodebuild_output = True project_file = 'dart.xcodeproj' if os.path.exists('dart-%s.gyp' % CurrentDirectoryBaseName()): project_file = 'dart-%s.xcodeproj' % CurrentDirectoryBaseName( ) args = [ 'xcodebuild', '-project', project_file, '-target', target, '-configuration', build_config, 'SYMROOT=%s' % os.path.abspath('xcodebuild') ] elif HOST_OS == 'win32': project_file = 'dart.sln' if os.path.exists('dart-%s.gyp' % CurrentDirectoryBaseName()): project_file = 'dart-%s.sln' % CurrentDirectoryBaseName( ) if target == 'all': args = [ options.devenv + os.sep + options.executable, '/build', build_config, project_file ] else: args = [ options.devenv + os.sep + options.executable, '/build', build_config, '/project', target, project_file ] else: make = 'make' if HOST_OS == 'freebsd': make = 'gmake' # work around lack of flock os.environ['LINK'] = '$(CXX)' args = [ make, '-j', options.j, 'BUILDTYPE=' + build_config, ] if target_os != HOST_OS: args += [ 'builddir_name=' + utils.GetBuildDir(HOST_OS, target_os) ] if options.verbose: args += ['V=1'] args += [target] toolchainprefix = options.toolchain toolsOverride = SetTools(arch, target_os, toolchainprefix) if toolsOverride: for k, v in toolsOverride.iteritems(): args.append(k + "=" + v) if options.verbose: print k + " = " + v if not os.path.isfile(toolsOverride['CC.target']): if arch == 'arm': print arm_cc_error else: print "Couldn't find compiler: %s" % toolsOverride[ 'CC.target'] return 1 print ' '.join(args) process = None if filter_xcodebuild_output: process = subprocess.Popen( args, stdin=None, bufsize=1, # Line buffered. stdout=subprocess.PIPE, stderr=subprocess.STDOUT) FilterEmptyXcodebuildSections(process) else: process = subprocess.Popen(args, stdin=None) process.wait() if process.returncode != 0: NotifyBuildDone(build_config, success=False, start=start_time) return 1 else: NotifyBuildDone(build_config, success=True, start=start_time) return 0
def Main(): utils.ConfigureJava() # Parse the options. parser = BuildOptions() (options, args) = parser.parse_args() if not ProcessOptions(options, args): parser.print_help() return 1 # Determine which targets to build. By default we build the "all" target. if len(args) == 0: if HOST_OS == 'macos': target = 'All' else: target = 'all' else: target = args[0] # Remember path old_path = os.environ['PATH'] # Build the targets for each requested configuration. for target_os in options.os: for mode in options.mode: for arch in options.arch: build_config = utils.GetBuildConf(mode, arch) if HOST_OS == 'macos': project_file = 'dart.xcodeproj' if os.path.exists('dart-%s.gyp' % CurrentDirectoryBaseName()): project_file = 'dart-%s.xcodeproj' % CurrentDirectoryBaseName() args = ['xcodebuild', '-project', project_file, '-target', target, '-parallelizeTargets', '-configuration', build_config, 'SYMROOT=%s' % os.path.abspath('xcodebuild') ] elif HOST_OS == 'win32': project_file = 'dart.sln' if os.path.exists('dart-%s.gyp' % CurrentDirectoryBaseName()): project_file = 'dart-%s.sln' % CurrentDirectoryBaseName() if target == 'all': args = [options.devenv + os.sep + 'devenv.com', '/build', build_config, project_file ] else: args = [options.devenv + os.sep + 'devenv.com', '/build', build_config, '/project', target, project_file ] else: make = 'make' if HOST_OS == 'freebsd': make = 'gmake' # work around lack of flock os.environ['LINK'] = '$(CXX)' args = [make, '-j', options.j, 'BUILDTYPE=' + build_config, ] if target_os != HOST_OS: args += ['builddir_name=' + utils.GetBuildDir(HOST_OS, target_os)] if options.verbose: args += ['V=1'] args += [target] if target_os != HOST_OS: SetCrossCompilationEnvironment( HOST_OS, target_os, arch, old_path) RunhooksIfNeeded(HOST_OS, mode, arch, target_os) toolchainprefix = None if target_os == 'android': toolchainprefix = ('%s/i686-linux-android' % os.environ['ANDROID_TOOLCHAIN']) toolsOverride = SetTools(arch, toolchainprefix) if toolsOverride: printToolOverrides = target_os != 'android' for k, v in toolsOverride.iteritems(): args.append( k + "=" + v) if printToolOverrides: print k + " = " + v print ' '.join(args) process = subprocess.Popen(args) process.wait() if process.returncode != 0: print "BUILD FAILED" return 1 return 0