def MakeFile(quiet, output_file, input_file, no_git_hash, custom_for_pub, version_file=None): if version_file: version_string = utils.GetVersion(no_git_hash, version_file) else: version_string = MakeVersionString(quiet, no_git_hash, custom_for_pub) version_cc_text = open(input_file).read() version_cc_text = version_cc_text.replace("{{VERSION_STR}}", version_string) channel = utils.GetChannel() version_cc_text = version_cc_text.replace("{{CHANNEL}}", channel) version_time = utils.GetGitTimestamp() if no_git_hash or version_time == None: version_time = "Unknown timestamp" version_cc_text = version_cc_text.replace("{{COMMIT_TIME}}", version_time.decode("utf-8")) abi_version = utils.GetAbiVersion(version_file) version_cc_text = version_cc_text.replace("{{ABI_VERSION}}", abi_version) oldest_supported_abi_version = utils.GetOldestSupportedAbiVersion( version_file) version_cc_text = version_cc_text.replace( "{{OLDEST_SUPPORTED_ABI_VERSION}}", oldest_supported_abi_version) snapshot_hash = MakeSnapshotHashString() version_cc_text = version_cc_text.replace("{{SNAPSHOT_HASH}}", snapshot_hash) open(output_file, 'w').write(version_cc_text) return True
def ExecuteCommand(options, args): cmd = options.command if (cmd == 'get'): # Always remove pubspec.lock before running 'pub get'. try: os.remove('pubspec.lock') except OSError as e: pass return PubCommand(options.dart_executable, options.pub_executable, options.pub_snapshot, ['get', '--offline'], options.silent) elif (cmd == 'build'): return PubCommand( options.dart_executable, options.pub_executable, options.pub_snapshot, [ 'build', '-DOBS_VER=' + utils.GetVersion(ignore_svn_revision=True), '--output', args[0] ], options.silent) elif (cmd == 'deploy'): Deploy('build', 'deployed') elif (cmd == 'rewrite'): RewritePubSpec(args[0], args[1], args[2], args[3]) else: print >> sys.stderr, ('ERROR: command "%s" not supported') % (cmd) return -1
def BuildDebianPackage(tarball, out_dir, arch): version = utils.GetVersion() tarroot = 'dart-%s' % version origtarname = 'dart_%s.orig.tar.gz' % version if not exists(tarball): print 'Source tarball not found' return -1 with utils.TempDir() as temp_dir: origtarball = join(temp_dir, origtarname) copyfile(tarball, origtarball) with tarfile.open(origtarball) as tar: tar.extractall(path=temp_dir) # Build source package. print "Building source package" RunBuildPackage(['-S', '-us', '-uc'], join(temp_dir, tarroot)); # Build 32-bit binary package. if ('ia32' in arch): print "Building i386 package" RunBuildPackage(['-B', '-ai386', '-us', '-uc'], join(temp_dir, tarroot)); # Build 64-bit binary package. if ('x64' in arch): print "Building amd64 package" RunBuildPackage(['-B', '-aamd64', '-us', '-uc'], join(temp_dir, tarroot)); # Copy the Debian package files to the build directory. debbase = 'dart_%s' % version source_package = [ '%s-1.dsc' % debbase, '%s.orig.tar.gz' % debbase, '%s-1.debian.tar.gz' % debbase ] i386_package = [ '%s-1_i386.deb' % debbase ] amd64_package = [ '%s-1_amd64.deb' % debbase ] for name in source_package: copyfile(join(temp_dir, name), join(out_dir, name)) if ('ia32' in arch): for name in i386_package: copyfile(join(temp_dir, name), join(out_dir, name)) if ('x64' in arch): for name in amd64_package: copyfile(join(temp_dir, name), join(out_dir, name))
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(): 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 Build(dart_executable, dart2js_executable, script_path, output_path, packages_path, silent): if dart2js_executable is not None: command = [dart2js_executable] else: if not silent: DisplayBootstrapWarning() command = [dart_executable, DART2JS_PATH] command += ['--no-preview-dart-2'] command += ['-DOBS_VER=' + utils.GetVersion(no_git_hash=True)] command += [ script_path, '-o', output_path, '--packages=%s' % packages_path ] # Add the defaults pub used command += ['--minify'] if not silent: print >> sys.stderr, 'Running command "%s"' % command return RunCommand(command)
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 BuildDebianPackage(tarball, out_dir, arch, toolchain): version = utils.GetVersion() tarroot = 'dartino-%s' % version origtarname = 'dartino_%s.orig.tar.gz' % version if not exists(tarball): print 'Source tarball not found' return -1 with utils.TempDir() as temp_dir: origtarball = join(temp_dir, origtarname) copyfile(tarball, origtarball) with tarfile.open(origtarball) as tar: tar.extractall(path=temp_dir) # Build source package. print "Building source package" RunBuildPackage(['-S', '-us', '-uc'], join(temp_dir, tarroot)) # Build the binary package for a ARM target on a x64 host. if 'armhf' in arch: print "Building package" RunBuildPackage(['-B', '-aarmhf', '-us', '-uc'], join(temp_dir, tarroot), toolchain) # Copy the Debian package files to the build directory. debbase = 'dartino_%s' % version agent_debbase = 'dartino-agent_%s' % version source_package = [ '%s-1.dsc' % debbase, '%s.orig.tar.gz' % debbase, '%s-1.debian.tar.gz' % debbase ] armhf_package = ['%s-1_armhf.deb' % agent_debbase] for name in source_package: copyfile(join(temp_dir, name), join(out_dir, name)) if ('armhf' in arch): for name in armhf_package: print "Writing package %s" % join(out_dir, name) copyfile(join(temp_dir, name), join(out_dir, name))
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 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 = 'armhf' arch = options.arch.split(',') if not options.out_dir: out_dir = join(DARTINO_DIR, 'out') if not tar_filename: tar_filename = join(DARTINO_DIR, utils.GetBuildDir(HOST_OS), 'dartino-%s.tar.gz' % utils.GetVersion()) BuildDebianPackage(tar_filename, out_dir, arch, options.toolchain)
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(): # Pull in all of the gypi files which will be munged into the sdk. HOME = dirname(dirname(realpath(__file__))) (options, args) = GetOptions() SDK = options.sdk_output_dir SDK_tmp = '%s.tmp' % SDK SNAPSHOT = options.snapshot_location # TODO(dgrove) - deal with architectures that are not ia32. if exists(SDK): rmtree(SDK) if exists(SDK_tmp): rmtree(SDK_tmp) os.makedirs(SDK_tmp) # Create and populate sdk/bin. BIN = join(SDK_tmp, 'bin') os.makedirs(BIN) os.makedirs(join(BIN, 'snapshots')) # Copy the Dart VM binary and the Windows Dart VM link library # into sdk/bin. # # TODO(dgrove) - deal with architectures that are not ia32. build_dir = os.path.dirname(SDK) dart_file_extension = '' if HOST_OS == 'win32': dart_file_extension = '.exe' dart_import_lib_src = join(HOME, build_dir, 'dart.lib') dart_import_lib_dest = join(BIN, 'dart.lib') copyfile(dart_import_lib_src, dart_import_lib_dest) dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension) dart_dest_binary = join(BIN, 'dart' + dart_file_extension) copyfile(dart_src_binary, dart_dest_binary) copymode(dart_src_binary, dart_dest_binary) # Strip the binaries on platforms where that is supported. if HOST_OS == 'linux': subprocess.call(['strip', dart_dest_binary]) elif HOST_OS == 'macos': subprocess.call(['strip', '-x', dart_dest_binary]) # # Create and populate sdk/include. # INCLUDE = join(SDK_tmp, 'include') os.makedirs(INCLUDE) copyfile(join(HOME, 'runtime', 'include', 'dart_api.h'), join(INCLUDE, 'dart_api.h')) copyfile(join(HOME, 'runtime', 'include', 'dart_debugger_api.h'), join(INCLUDE, 'dart_debugger_api.h')) copyfile(join(HOME, 'runtime', 'include', 'dart_mirrors_api.h'), join(INCLUDE, 'dart_mirrors_api.h')) copyfile(join(HOME, 'runtime', 'include', 'dart_native_api.h'), join(INCLUDE, 'dart_native_api.h')) # # Create and populate sdk/lib. # LIB = join(SDK_tmp, 'lib') os.makedirs(LIB) # # Create and populate lib/{async, core, isolate, ...}. # os.makedirs(join(LIB, 'html')) for library in [ join('_blink', 'dartium'), join('_chrome', 'dart2js'), join('_chrome', 'dartium'), join('_internal', 'compiler'), 'async', 'collection', 'convert', 'core', 'internal', 'io', 'isolate', join('html', 'dart2js'), join('html', 'dartium'), join('html', 'html_common'), join('indexed_db', 'dart2js'), join('indexed_db', 'dartium'), 'js', 'math', 'mirrors', 'typed_data', 'profiler', join('svg', 'dart2js'), join('svg', 'dartium'), join('web_audio', 'dart2js'), join('web_audio', 'dartium'), join('web_gl', 'dart2js'), join('web_gl', 'dartium'), join('web_sql', 'dart2js'), join('web_sql', 'dartium') ]: copytree(join(HOME, 'sdk', 'lib', library), join(LIB, library), ignore=ignore_patterns('*.svn', 'doc', '*.py', '*.gypi', '*.sh', '.gitignore')) # Copy lib/_internal/libraries.dart. copyfile(join(HOME, 'sdk', 'lib', '_internal', 'libraries.dart'), join(LIB, '_internal', 'libraries.dart')) # Create and copy tools. UTIL = join(SDK_tmp, 'util') os.makedirs(UTIL) RESOURCE = join(SDK_tmp, 'lib', '_internal', 'pub', 'asset') os.makedirs(os.path.dirname(RESOURCE)) copytree(join(HOME, 'sdk', 'lib', '_internal', 'pub', 'asset'), join(RESOURCE), ignore=ignore_patterns('.svn')) copytree(join(SNAPSHOT, 'core_stubs'), join(RESOURCE, 'dart', 'core_stubs')) # Copy in 7zip for Windows. if HOST_OS == 'win32': copytree(join(HOME, 'third_party', '7zip'), join(RESOURCE, '7zip'), ignore=ignore_patterns('.svn')) # Copy dart2js/pub. CopyDartScripts(HOME, SDK_tmp) CopySnapshots(SNAPSHOT, SDK_tmp) # Write the 'version' file version = utils.GetVersion() versionFile = open(os.path.join(SDK_tmp, 'version'), 'w') versionFile.write(version + '\n') versionFile.close() # Write the 'revision' file revision = utils.GetSVNRevision() if revision is not None: with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: f.write(revision + '\n') f.close() Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) move(SDK_tmp, SDK)
def Main(): # Pull in all of the gypi files which will be munged into the sdk. HOME = dirname(dirname(realpath(__file__))) (options, args) = GetOptions() SDK = options.sdk_output_dir SDK_tmp = '%s.tmp' % SDK SNAPSHOT = options.snapshot_location # TODO(dgrove) - deal with architectures that are not ia32. if exists(SDK): rmtree(SDK) if exists(SDK_tmp): rmtree(SDK_tmp) os.makedirs(SDK_tmp) # Create and populate sdk/bin. BIN = join(SDK_tmp, 'bin') os.makedirs(BIN) os.makedirs(join(BIN, 'snapshots')) # Copy the Dart VM binary and the Windows Dart VM link library # into sdk/bin. # # TODO(dgrove) - deal with architectures that are not ia32. build_dir = os.path.dirname(SDK) dart_file_extension = '' if HOST_OS == 'win32': dart_file_extension = '.exe' dart_import_lib_src = join(HOME, build_dir, 'dart.lib') dart_import_lib_dest = join(BIN, 'dart.lib') copyfile(dart_import_lib_src, dart_import_lib_dest) dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension) dart_dest_binary = join(BIN, 'dart' + dart_file_extension) copyfile(dart_src_binary, dart_dest_binary) copymode(dart_src_binary, dart_dest_binary) # Strip the binaries on platforms where that is supported. if HOST_OS == 'linux' and not options.disable_stripping: subprocess.call(['strip', dart_dest_binary]) elif HOST_OS == 'macos' and not options.disable_stripping: subprocess.call(['strip', '-x', dart_dest_binary]) # # Create and populate sdk/include. # INCLUDE = join(SDK_tmp, 'include') os.makedirs(INCLUDE) copyfile(join(HOME, 'runtime', 'include', 'dart_api.h'), join(INCLUDE, 'dart_api.h')) copyfile(join(HOME, 'runtime', 'include', 'dart_mirrors_api.h'), join(INCLUDE, 'dart_mirrors_api.h')) copyfile(join(HOME, 'runtime', 'include', 'dart_native_api.h'), join(INCLUDE, 'dart_native_api.h')) copyfile(join(HOME, 'runtime', 'include', 'dart_tools_api.h'), join(INCLUDE, 'dart_tools_api.h')) # # Create and populate sdk/lib. # LIB = join(SDK_tmp, 'lib') os.makedirs(LIB) # # Create and populate lib/{async, core, isolate, ...}. # os.makedirs(join(LIB, 'html')) for library in [ join('_blink', 'dartium'), join('_chrome', 'dart2js'), join('_chrome', 'dartium'), join('_internal', 'js_runtime'), join('_internal', 'sdk_library_metadata'), 'async', 'collection', 'convert', 'core', 'developer', 'internal', 'io', 'isolate', join('html', 'dart2js'), join('html', 'dartium'), join('html', 'html_common'), join('indexed_db', 'dart2js'), join('indexed_db', 'dartium'), 'js', 'js_util', 'math', 'mirrors', 'profiler', 'typed_data', join('svg', 'dart2js'), join('svg', 'dartium'), join('web_audio', 'dart2js'), join('web_audio', 'dartium'), join('web_gl', 'dart2js'), join('web_gl', 'dartium'), join('web_sql', 'dart2js'), join('web_sql', 'dartium') ]: copytree(join(HOME, 'sdk', 'lib', library), join(LIB, library), ignore=ignore_patterns('*.svn', 'doc', '*.py', '*.gypi', '*.sh', '.gitignore')) # Copy the platform descriptors. for file_name in [ "dart_client.platform", "dart_server.platform", "dart_shared.platform" ]: copyfile(join(HOME, 'sdk', 'lib', file_name), join(LIB, file_name)) # Copy libraries.dart to lib/_internal/libraries.dart for backwards # compatibility. # # TODO(sigmund): stop copying libraries.dart. Old versions (<=0.25.1-alpha.4) # of the analyzer package do not support the new location of this file. We # should be able to remove the old file once we release a newer version of # analyzer and popular frameworks have migrated to use it. copyfile( join(HOME, 'sdk', 'lib', '_internal', 'sdk_library_metadata', 'lib', 'libraries.dart'), join(LIB, '_internal', 'libraries.dart')) # Create and copy tools. UTIL = join(SDK_tmp, 'util') os.makedirs(UTIL) RESOURCE = join(SDK_tmp, 'lib', '_internal', 'pub', 'asset') os.makedirs(os.path.dirname(RESOURCE)) copytree(join(HOME, 'third_party', 'pkg', 'pub', 'lib', 'src', 'asset'), join(RESOURCE), ignore=ignore_patterns('.svn')) # Copy in 7zip for Windows. if HOST_OS == 'win32': copytree(join(HOME, 'third_party', '7zip'), join(RESOURCE, '7zip'), ignore=ignore_patterns('.svn')) # Copy dart2js/pub. CopyDartScripts(HOME, SDK_tmp) CopySnapshots(SNAPSHOT, SDK_tmp) CopyDartdocResources(HOME, SDK_tmp) CopyAnalyzerSources(HOME, LIB) CopyAnalysisSummaries(SNAPSHOT, LIB) CopyDevCompilerSdk(HOME, LIB) if options.copy_libs: CopyLibs(build_dir, BIN) # Write the 'version' file version = utils.GetVersion() versionFile = open(os.path.join(SDK_tmp, 'version'), 'w') versionFile.write(version + '\n') versionFile.close() # Write the 'revision' file revision = utils.GetGitRevision() if revision is not None: with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: f.write('%s\n' % revision) f.close() Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) Copy(join(HOME, 'LICENSE'), join(SDK_tmp, 'LICENSE')) Copy(join(HOME, 'sdk', 'api_readme.md'), join(SDK_tmp, 'lib', 'api_readme.md')) move(SDK_tmp, SDK)
def Main(argv): args = ParseArgs(argv) version = utils.GetVersion() with open(args.output, 'w') as versionFile: versionFile.write(version + '\n') return 0
def Main(): global OUTPUT global BUILD parser = BuildOptions() (options, args) = parser.parse_args() if args: parser.print_help() return 1 osName = utils.GuessOS() mode = 'debug' arch = utils.GuessArchitecture() if not options.build: print >> sys.stderr, 'Error: no --build option specified' exit(1) else: BUILD = options.build if not options.out: print >> sys.stderr, 'Error: no --out option specified' exit(1) else: # TODO(devoncarew): Currently we scrape the output path to determine the # mode and arch. This is fragile and should moved into one location # (utils.py?) or made more explicit. OUTPUT = options.out mode = ('release', 'debug')['Debug' in OUTPUT] arch = ('ia32', 'x64')['X64' in OUTPUT] # Use explicit mode and arch information. if options.mode: mode = options.mode if options.arch: arch = options.arch OUTPUT = os.path.abspath(OUTPUT) BUILD = os.path.abspath(BUILD) print "\nBuilding the editor" print " config : %s, %s, %s" % (osName, arch, mode) print " output : %s" % OUTPUT # Clean the editor output directory. print '\ncleaning %s' % OUTPUT shutil.rmtree(OUTPUT, True) # These are the valid eclipse build configurations that we can produce. # We synthesize these up from the OS_CONFIG and ARCH_CONFIG information. # macosx, cocoa, x86 & macosx, cocoa, x86_64 # win32, win32, x86 & win32, win32, x86_64 # linux, gtk, x86 & linux, gtk, x86_64 buildConfig = OS_CONFIG[osName] + ', ' + ARCH_CONFIG[arch] print "\ninvoking build_rcp.xml with buildConfig = [%s]\n" % buildConfig sys.stdout.flush() sys.stderr.flush() buildScript = join('editor', 'tools', 'features', 'com.google.dart.tools.deploy.feature_releng', 'build_rcp.xml') build_cmd = [ AntPath(), '-lib', join('third_party', 'bzip2', 'bzip2.jar'), '-Dbuild.out=' + OUTPUT, '-Dbuild.configs=' + buildConfig, '-Dbuild.root=' + GetEclipseBuildRoot(), '-Dbuild.downloads=' + GetDownloadCache(), '-Dbuild.source=' + os.path.abspath('editor'), '-Dbuild.dart.sdk=' + GetSdkPath(), '-Dbuild.no.properties=true', '-Dbuild.channel=' + utils.GetChannel(), '-Dbuild.revision=' + utils.GetSVNRevision(), '-Dbuild.version.qualifier=' + utils.GetEclipseVersionQualifier(), '-Ddart.version.full=' + utils.GetVersion(), '-buildfile', buildScript ] print build_cmd buildRcpStatus = subprocess.call(build_cmd, shell=utils.IsWindows()) if buildRcpStatus != 0: sys.exit(buildRcpStatus) # build_rcp.xml will put the built editor archive in the OUTPUT directory # (dart-editor-macosx.cocoa.x86.zip). It contains the editor application in a # dart/ subdirectory. We unzip the contents of the archive into OUTPUT. It # will use the ../dart-sdk directory as its SDK. archives = glob.glob(join(OUTPUT, '*.zip')) if archives: ProcessEditorArchive(arch, archives[0], OUTPUT) if os.path.exists(GetEditorTemp()): shutil.rmtree(GetEditorTemp()) print('\nEditor build successful')
def makeVersionString(): version_string = utils.GetVersion() debugLog("Returning version string: %s " % version_string) return version_string
def Main(): print utils.GetVersion()
def Main(argv): # Pull in all of the gypi files which will be munged into the sdk. HOME = dirname(dirname(realpath(__file__))) (options, args) = GetOptions() SDK = options.sdk_output_dir SDK_tmp = '%s.tmp' % SDK SNAPSHOT = options.utils_snapshot_location # TODO(dgrove) - deal with architectures that are not ia32. if exists(SDK): rmtree(SDK) if exists(SDK_tmp): rmtree(SDK_tmp) os.makedirs(SDK_tmp) # Create and populate sdk/bin. BIN = join(SDK_tmp, 'bin') os.makedirs(BIN) os.makedirs(join(BIN, 'snapshots')) # Copy the Dart VM binary and the Windows Dart VM link library # into sdk/bin. # # TODO(dgrove) - deal with architectures that are not ia32. build_dir = os.path.dirname(SDK) dart_file_extension = '' analyzer_file_extension = '' if HOST_OS == 'win32': dart_file_extension = '.exe' analyzer_file_extension = '.bat' dart_import_lib_src = join(HOME, build_dir, 'dart.lib') dart_import_lib_dest = join(BIN, 'dart.lib') copyfile(dart_import_lib_src, dart_import_lib_dest) dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension) dart_dest_binary = join(BIN, 'dart' + dart_file_extension) copyfile(dart_src_binary, dart_dest_binary) copymode(dart_src_binary, dart_dest_binary) # Strip the binaries on platforms where that is supported. if HOST_OS == 'linux': subprocess.call(['strip', dart_dest_binary]) elif HOST_OS == 'macos': subprocess.call(['strip', '-x', dart_dest_binary]) # Copy analyzer into sdk/bin ANALYZER_HOME = join(HOME, build_dir, 'analyzer') dart_analyzer_src_binary = join(ANALYZER_HOME, 'bin', 'dart_analyzer' + analyzer_file_extension) dart_analyzer_dest_binary = join(BIN, 'dart_analyzer' + analyzer_file_extension) copyfile(dart_analyzer_src_binary, dart_analyzer_dest_binary) copymode(dart_analyzer_src_binary, dart_analyzer_dest_binary) # Create pub shell script. # TODO(dgrove) - delete this once issue 6619 is fixed pub_src_script = join(HOME, 'utils', 'pub', 'sdk', 'pub') CopyShellScript(pub_src_script, BIN) # # Create and populate sdk/include. # INCLUDE = join(SDK_tmp, 'include') os.makedirs(INCLUDE) copyfile(join(HOME, 'runtime', 'include', 'dart_api.h'), join(INCLUDE, 'dart_api.h')) copyfile(join(HOME, 'runtime', 'include', 'dart_debugger_api.h'), join(INCLUDE, 'dart_debugger_api.h')) # # Create and populate sdk/lib. # LIB = join(SDK_tmp, 'lib') os.makedirs(LIB) # # Create and populate lib/{core, crypto, isolate, json, uri, utf, ...}. # os.makedirs(join(LIB, 'html')) for library in [ '_internal', 'async', 'collection', '_collection_dev', 'core', 'crypto', 'io', 'isolate', join('chrome', 'dart2js'), join('chrome', 'dartium'), join('html', 'dart2js'), join('html', 'dartium'), join('html', 'html_common'), join('indexed_db', 'dart2js'), join('indexed_db', 'dartium'), 'json', 'math', 'mirrors', 'typeddata', join('svg', 'dart2js'), join('svg', 'dartium'), 'uri', 'utf', join('web_audio', 'dart2js'), join('web_audio', 'dartium'), join('web_gl', 'dart2js'), join('web_gl', 'dartium'), join('web_sql', 'dart2js'), join('web_sql', 'dartium') ]: copytree(join(HOME, 'sdk', 'lib', library), join(LIB, library), ignore=ignore_patterns('*.svn', 'doc', '*.py', '*.gypi', '*.sh')) # Create and copy packages. PACKAGES = join(SDK_tmp, 'packages') os.makedirs(PACKAGES) # # Create and populate packages/{args, intl, logging, meta, unittest, ...} # for library in [ 'args', 'http', 'intl', 'logging', 'meta', 'oauth2', 'pathos', 'serialization', 'unittest', 'yaml', 'analyzer_experimental' ]: copytree(join(HOME, 'pkg', library, 'lib'), join(PACKAGES, library), ignore=ignore_patterns('*.svn')) # Create and copy tools. UTIL = join(SDK_tmp, 'util') os.makedirs(UTIL) # Create and copy Analyzer library into 'util' ANALYZER_DEST = join(UTIL, 'analyzer') os.makedirs(ANALYZER_DEST) analyzer_src_jar = join(ANALYZER_HOME, 'util', 'analyzer', 'dart_analyzer.jar') analyzer_dest_jar = join(ANALYZER_DEST, 'dart_analyzer.jar') copyfile(analyzer_src_jar, analyzer_dest_jar) jarsToCopy = [ join("args4j", "2.0.12", "args4j-2.0.12.jar"), join("guava", "r13", "guava-13.0.1.jar"), join("json", "r2_20080312", "json.jar") ] for jarToCopy in jarsToCopy: dest_dir = join(ANALYZER_DEST, os.path.dirname(jarToCopy)) os.makedirs(dest_dir) dest_file = join(ANALYZER_DEST, jarToCopy) src_file = join(ANALYZER_HOME, 'util', 'analyzer', jarToCopy) copyfile(src_file, dest_file) # Create and copy dartanalyzer into 'util' DARTANALYZER_SRC = join(HOME, build_dir, 'dartanalyzer') DARTANALYZER_DEST = join(UTIL, 'dartanalyzer') os.makedirs(DARTANALYZER_DEST) jarFiles = glob.glob(join(DARTANALYZER_SRC, '*.jar')) for jarFile in jarFiles: copyfile(jarFile, join(DARTANALYZER_DEST, os.path.basename(jarFile))) # Create and populate util/pub. copytree(join(HOME, 'utils', 'pub'), join(UTIL, 'pub'), ignore=ignore_patterns('.svn', 'sdk')) # Copy in 7zip for Windows. if HOST_OS == 'win32': copytree(join(HOME, 'third_party', '7zip'), join(join(UTIL, 'pub'), '7zip'), ignore=ignore_patterns('.svn')) ReplaceInFiles([ join(UTIL, 'pub', 'io.dart'), ], [ ("../../third_party/7zip/7za.exe", "7zip/7za.exe"), ]) # Copy dart2js/dartdoc/pub. CopyDartScripts(HOME, SDK_tmp) CopySnapshots(SNAPSHOT, SDK_tmp) # Write the 'version' file version = utils.GetVersion() versionFile = open(os.path.join(SDK_tmp, 'version'), 'w') versionFile.write(version + '\n') versionFile.close() # Write the 'revision' file revision = utils.GetSVNRevision() if revision is not None: with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: f.write(revision + '\n') f.close() Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) move(SDK_tmp, SDK)
def Main(argv): print(utils.GetVersion())
def Main(): version = utils.GetVersion() if not version: print 'Error: Couldn\'t determine version string.' return 1 print version