def UploadAPKs(options): with bot.BuildStep('Upload apk'): revision = utils.GetSVNRevision() namer = bot_utils.GCSNamer(internal=True) # The version of gsutil we have on the bots is not new enough to support # the acl set commands. bot_utils.GSUtil.USE_DART_REPO_VERSION = True gsutil = bot_utils.GSUtil() # Archive dartuim local = os.path.join(options.build_products_dir, APK_LOCATION) # TODO(whesse): pass in arch and mode from reciepe remote = namer.dartium_android_apk_filepath(revision, 'dartium-android', 'arm', 'release') web_link_prefix = 'https://storage.cloud.google.com/' dartium_link = string.replace(remote, 'gs://', web_link_prefix) UploadSetACL(gsutil, local, remote) print "Uploaded dartium, available from: %s" % dartium_link # Archive content shell local = os.path.join(options.build_products_dir, CS_LOCATION) # TODO(whesse): pass in arch and mode from reciepe remote = namer.dartium_android_apk_filepath(revision, 'content_shell-android', 'arm', 'release') content_shell_link = string.replace(remote, 'gs://', web_link_prefix) UploadSetACL(gsutil, local, remote) print "Uploaded content shell, available from: %s" % content_shell_link
def main(argv): #allow local editor builds to deploy to a different bucket if os.environ.has_key('DART_LOCAL_BUILD'): gsdir = os.environ['DART_LOCAL_BUILD'] else: gsdir = GS_DIR if not os.path.exists(argv[1]): sys.stderr.write('Path not found: %s\n' % argv[1]) Usage(argv[0]) return 1 if not os.path.exists(GSUTIL): #TODO: Determine where we are running, if we're running on a buildbot we #should fail with a message. #If we are not on a buildbot then fail silently. utils.Touch(os.path.join(argv[1], 'upload.stamp')) exit(0) revision = utils.GetSVNRevision() if revision is None: sys.stderr.write('Unable to find SVN revision.\n') return 1 os.chdir(os.path.dirname(argv[1])) if (os.path.basename(os.path.dirname(argv[1])) == utils.GetBuildConf('release', 'ia32')): sdk_suffix = '' else: sdk_suffix = '-debug' # TODO(dgrove) - deal with architectures that are not ia32. sdk_file_zip = 'dart-%s-%s%s.zip' % (utils.GuessOS(), revision, sdk_suffix) sdk_file_targz = 'dart-%s-%s%s.tar.gz' % (utils.GuessOS(), revision, sdk_suffix) if (os.path.exists(SDK_LOCAL_ZIP)): os.remove(SDK_LOCAL_ZIP) if (os.path.exists(SDK_LOCAL_TARGZ)): os.remove(SDK_LOCAL_TARGZ) if platform.system() == 'Windows': # Windows does not have zip. We use the 7 zip utility in third party. ExecuteCommand([os.path.join('..', 'third_party', '7zip', '7za'), 'a', '-tzip', SDK_LOCAL_ZIP, os.path.basename(argv[1])]) else: ExecuteCommand(['zip', '-yr', SDK_LOCAL_ZIP, os.path.basename(argv[1])]) ExecuteCommand(['tar', 'czf', SDK_LOCAL_TARGZ, os.path.basename(argv[1])]) UploadArchive(SDK_LOCAL_ZIP, GS_SITE + '/'.join([gsdir, GS_SDK_DIR, sdk_file_zip])) if (os.path.exists(SDK_LOCAL_TARGZ)): UploadArchive(SDK_LOCAL_TARGZ, GS_SITE + '/'.join([gsdir, GS_SDK_DIR, sdk_file_targz])) latest_name_zip = 'dart-%s-latest%s.zip' % (utils.GuessOS(), sdk_suffix) latest_name_targz = 'dart-%s-latest%s.tar.gz' % (utils.GuessOS(), sdk_suffix) UploadArchive(SDK_LOCAL_ZIP, GS_SITE + '/'.join([gsdir, GS_SDK_DIR, latest_name_zip])) if (os.path.exists(SDK_LOCAL_TARGZ)): UploadArchive(SDK_LOCAL_TARGZ, GS_SITE + '/'.join([gsdir, GS_SDK_DIR, latest_name_targz])) utils.Touch('upload.stamp')
def main(): GetOptions() SetGsutil() # Execute Docgen.dart on the SDK. utils.ExecuteCommand(['python', 'dartdoc.py', '-d']) # Use SVN Revision to get the revision number. revision = None if trustSVN: revision = utils.GetSVNRevision() if revision is None: # Try to find the version from the dart-sdk folder. revision_file_location = abspath( join( dirname(__file__), '../../../%s/%s/dart-sdk/revision' % (utils.BUILD_ROOT[utils.GuessOS()], utils.GetBuildConf('release', utils.GuessArchitecture())))) with open(revision_file_location, 'r') as revision_file: revision = revision_file.readline(5) revision_file.close() if revision is None: raise Exception("Unable to find revision. ") # Upload the all files in Docs into a folder based off Revision number on # Cloud Storage. # TODO(alanknight): If we give it ./docs/* it fails to upload files in the # subdirectory, probably due to escaping. Work around it by changing dir. # Better, generalize this to be less dependent on the working directory. os.chdir('docs') Upload('.', GS_SITE + '/' + revision + '/') os.chdir('..') # Update VERSION file in Cloud Storage. with open('VERSION', 'w') as version_file: version_file.write(revision) version_file.close() Upload('./VERSION', GS_SITE + '/VERSION') Upload('./VERSION', GS_SITE + '/' + revision + '/' + 'VERSION') # Clean up the files it creates. utils.ExecuteCommand(['rm', '-rf', './docs']) utils.ExecuteCommand(['rm', '-f', './VERSION'])
def UploadAPKs(options): with bot.BuildStep('Upload apk'): revision = utils.GetSVNRevision() namer = bot_utils.GCSNamer() gsutil = bot_utils.GSUtil() web_link_prefix = 'https://storage.cloud.google.com/' # Archive content shell local = os.path.join(options.build_products_dir, CS_LOCATION) # TODO(whesse): pass in arch and mode from reciepe remote = namer.dartium_android_apk_filepath(revision, 'content_shell-android', 'arm', 'release') content_shell_link = string.replace(remote, 'gs://', web_link_prefix) UploadSetACL(gsutil, local, remote) print "Uploaded content shell, available from: %s" % content_shell_link
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 UploadAPKs(options): with bot.BuildStep('Upload apk'): bot_name = os.environ.get('BUILDBOT_BUILDERNAME') on_fyi = 'fyi-' in os.environ.get('BUILDBOT_SCHEDULER') if '-integration' in bot_name or on_fyi: return channel = bot_utils.GetChannelFromName(bot_name) namer = bot_utils.GCSNamer(channel=channel) gsutil = bot_utils.GSUtil() web_link_prefix = 'https://storage.cloud.google.com/' # Archive content shell local = os.path.join(options.build_products_dir, CS_LOCATION) for revision in [utils.GetSVNRevision(), 'latest']: # TODO(whesse): pass in arch and mode from reciepe remote = namer.dartium_android_apk_filepath(revision, 'content_shell-android', 'arm', 'release') content_shell_link = string.replace(remote, 'gs://', web_link_prefix) UploadSetACL(gsutil, local, remote) print "Uploaded content shell, available from: %s" % content_shell_link
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 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(): # 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(argv): # Pull in all of the gpyi files which will be munged into the sdk. io_runtime_sources = \ (eval(open("runtime/bin/io_sources.gypi").read()))['sources'] HOME = dirname(dirname(realpath(__file__))) SDK_tmp = tempfile.mkdtemp() SDK = argv[1] # TODO(dgrove) - deal with architectures that are not ia32. if exists(SDK): rmtree(SDK) # Create and populate sdk/bin. BIN = join(SDK_tmp, 'bin') os.makedirs(BIN) # 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(argv[1]) dart_file_extension = '' analyzer_file_extension = '' if utils.GuessOS() == 'win32': dart_file_extension = '.exe' analyzer_file_extension = '.bat' # TODO(zundel): test on Windows 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) if ShouldCopyAnalyzer(): # Copy analyzer into sdk/bin ANALYZER_HOME = join(HOME, build_dir, 'analyzer') dart_analyzer_src_binary = join(ANALYZER_HOME, 'bin', 'dart_analyzer') 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. 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/io. # io_dest_dir = join(LIB, 'io') os.makedirs(io_dest_dir) os.makedirs(join(io_dest_dir, 'runtime')) for filename in io_runtime_sources: assert filename.endswith('.dart') if filename == 'io.dart': copyfile(join(HOME, 'runtime', 'bin', filename), join(io_dest_dir, 'io_runtime.dart')) else: copyfile(join(HOME, 'runtime', 'bin', filename), join(io_dest_dir, 'runtime', filename)) # Construct lib/io/io_runtime.dart from whole cloth. dest_file = open(join(io_dest_dir, 'io_runtime.dart'), 'a') for filename in io_runtime_sources: assert filename.endswith('.dart') if filename == 'io.dart': continue dest_file.write('#source("runtime/' + filename + '");\n') dest_file.close() # # Create and populate lib/{core, crypto, isolate, json, uri, utf, ...}. # os.makedirs(join(LIB, 'html')) for library in [ '_internal', 'core', 'coreimpl', 'crypto', 'isolate', join('html', 'dart2js'), join('html', 'dartium'), 'json', 'math', 'mirrors', 'scalarlist', 'uri', 'utf' ]: copytree(join(HOME, 'lib', library), join(LIB, library), ignore=ignore_patterns('*.svn', 'doc', '*.py', '*.gypi', '*.sh')) # Create and copy pkg. PKG = join(SDK_tmp, 'pkg') os.makedirs(PKG) # # Create and populate pkg/{args, intl, logging, meta, unittest} # for library in [ 'args', 'htmlescape', 'dartdoc', 'intl', 'logging', 'meta', 'unittest' ]: copytree(join(HOME, 'pkg', library), join(PKG, library), ignore=ignore_patterns('*.svn', 'doc', 'docs', '*.py', '*.gypi', '*.sh')) # TODO(dgrove): Remove this once issue 4788 is addressed. copytree(join(HOME, 'lib', 'compiler'), join(PKG, 'compiler'), ignore=ignore_patterns('*.svn', 'doc', '*.py', '*.gypi', '*.sh')) ReplaceInFiles([join(LIB, '_internal', 'libraries.dart')], [('"compiler/', '"../pkg/compiler/')]) ReplaceInFiles([join(PKG, 'compiler', 'implementation', 'lib', 'io.dart')], [('../../runtime/bin', '../../lib/io/runtime')]) # Fixup dartdoc # TODO(dgrove): Remove this once issue 4788 is addressed. ReplaceInFiles([ join(PKG, 'dartdoc', 'lib', 'src', 'mirrors', 'dart2js_mirror.dart'), join(PKG, 'dartdoc', 'lib', 'mirrors_util.dart'), join(PKG, 'dartdoc', 'lib', 'classify.dart'), join(PKG, 'dartdoc', 'lib', 'src', 'client', 'client-live-nav.dart'), join(PKG, 'dartdoc', 'lib', 'src', 'client', 'client-static.dart'), join(PKG, 'dartdoc', 'lib', 'dartdoc.dart'), ], [ ("../../lib/compiler", "../../pkg/compiler"), ]) # Create and copy tools. UTIL = join(SDK_tmp, 'util') os.makedirs(UTIL) if ShouldCopyAnalyzer(): # 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", "r09", "guava-r09.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 populate util/pub. copytree(join(HOME, 'utils', 'pub'), join(UTIL, 'pub'), ignore=ignore_patterns('.svn', 'sdk')) # Copy in 7zip for Windows. if utils.GuessOS() == 'win32': copytree(join(HOME, 'third_party', '7zip'), join(join(UTIL, 'pub'), '7zip'), ignore=ignore_patterns('.svn')) ReplaceInFiles([ join(UTIL, 'pub', 'io.dart'), ], [ ("var pathTo7zip = '../../third_party/7zip/7za.exe';", "var pathTo7zip = '7zip/7za.exe';"), ]) revision = utils.GetSVNRevision() # Copy dart2js. CopyDart2Js(build_dir, SDK_tmp, revision) # Write the 'revision' file 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 UploadInstaller(dart_editor_dmg, directory): directory = directory % {'revision': utils.GetSVNRevision()} uri = '%s/%s' % (GCS_EDITOR_BUCKET, directory) RunProcess([GSUTIL, 'cp', dart_editor_dmg, uri]) RunProcess([GSUTIL, 'setacl', 'public-read', uri])
def Main(argv): # Pull in all of the gpyi files which will be munged into the sdk. builtin_runtime_sources = \ (eval(open("runtime/bin/builtin_sources.gypi").read()))['sources'] io_runtime_sources = \ (eval(open("runtime/bin/io_sources.gypi").read()))['sources'] corelib_sources = \ (eval(open("corelib/src/corelib_sources.gypi").read()))['sources'] corelib_runtime_sources = \ (eval(open("runtime/lib/lib_sources.gypi").read()))['sources'] coreimpl_sources = \ (eval(open("corelib/src/implementation/corelib_impl_sources.gypi").read()))\ ['sources'] coreimpl_runtime_sources = \ (eval(open("runtime/lib/lib_impl_sources.gypi").read()))['sources'] HOME = dirname(dirname(realpath(__file__))) SDK_tmp = tempfile.mkdtemp() SDK = argv[1] # TODO(dgrove) - deal with architectures that are not ia32. if exists(SDK): rmtree(SDK) # Create and populate sdk/bin. BIN = join(SDK_tmp, 'bin') os.makedirs(BIN) # 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(argv[1]) dart_file_extension = '' analyzer_file_extension = '' if utils.GuessOS() == 'win32': dart_file_extension = '.exe' analyzer_file_extension = '.bat' # TODO(zundel): test on Windows 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) if ShouldCopyAnalyzer(): # Copy analyzer into sdk/bin ANALYZER_HOME = join(HOME, build_dir, 'analyzer') dart_analyzer_src_binary = join(ANALYZER_HOME, 'bin', 'dart_analyzer') 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. 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) corelib_dest_dir = join(LIB, 'core') os.makedirs(corelib_dest_dir) os.makedirs(join(corelib_dest_dir, 'runtime')) coreimpl_dest_dir = join(LIB, 'coreimpl') os.makedirs(coreimpl_dest_dir) os.makedirs(join(coreimpl_dest_dir, 'runtime')) # # Create and populate lib/builtin. # builtin_dest_dir = join(LIB, 'builtin') os.makedirs(builtin_dest_dir) assert len(builtin_runtime_sources) == 1 assert builtin_runtime_sources[0] == 'builtin.dart' copyfile(join(HOME, 'runtime', 'bin', 'builtin.dart'), join(builtin_dest_dir, 'builtin_runtime.dart')) # # rename the print function in dart:builtin # so that it does not conflict with the print function in dart:core # ReplaceInFiles([ join(builtin_dest_dir, 'builtin_runtime.dart') ], [ ('void print\(', 'void builtinPrint(') ]) # # Create and populate lib/io. # io_dest_dir = join(LIB, 'io') os.makedirs(io_dest_dir) os.makedirs(join(io_dest_dir, 'runtime')) for filename in io_runtime_sources: assert filename.endswith('.dart') if filename == 'io.dart': copyfile(join(HOME, 'runtime', 'bin', filename), join(io_dest_dir, 'io_runtime.dart')) else: copyfile(join(HOME, 'runtime', 'bin', filename), join(io_dest_dir, 'runtime', filename)) # Construct lib/io/io_runtime.dart from whole cloth. dest_file = open(join(io_dest_dir, 'io_runtime.dart'), 'a') for filename in io_runtime_sources: assert filename.endswith('.dart') if filename == 'io.dart': continue dest_file.write('#source("runtime/' + filename + '");\n') dest_file.close() # # Create and populate lib/compiler. # compiler_src_dir = join(HOME, 'lib', 'compiler') compiler_dest_dir = join(LIB, 'compiler') copytree(compiler_src_dir, compiler_dest_dir, ignore=ignore_patterns('.svn')) # Remap imports in lib/compiler/* . for (dirpath, subdirs, filenames) in os.walk(compiler_dest_dir): for filename in filenames: if filename.endswith('.dart'): filename = join(dirpath, filename) file_contents = open(filename).read() file = open(filename, 'w') file_contents = re.sub(r"\.\./lib", "..", file_contents) file.write(file_contents) file.close() # # Create and populate lib/html. # html_src_dir = join(HOME, 'lib', 'html') html_dest_dir = join(LIB, 'html') os.makedirs(html_dest_dir) copyfile(join(html_src_dir, 'frog', 'html_frog.dart'), join(html_dest_dir, 'html_frog.dart')) copyfile(join(html_src_dir, 'dartium', 'html_dartium.dart'), join(html_dest_dir, 'html_dartium.dart')) copyfile(join(html_src_dir, 'dartium', 'nativewrappers.dart'), join(html_dest_dir, 'nativewrappers.dart')) # # Create and populate lib/dom. # dom_src_dir = join(HOME, 'lib', 'dom') dom_dest_dir = join(LIB, 'dom') os.makedirs(dom_dest_dir) copyfile(join(dom_src_dir, 'frog', 'dom_frog.dart'), join(dom_dest_dir, 'dom_frog.dart')) # # Create and populate lib/{crypto, json, uri, utf, ...}. # for library in ['crypto', 'json', 'unittest', 'uri', 'utf', 'i18n', 'web']: src_dir = join(HOME, 'lib', library) dest_dir = join(LIB, library) os.makedirs(dest_dir) for filename in os.listdir(src_dir): if filename.endswith('.dart'): copyfile(join(src_dir, filename), join(dest_dir, filename)) # Create and populate lib/dartdoc. dartdoc_src_dir = join(HOME, 'lib', 'dartdoc') dartdoc_dest_dir = join(LIB, 'dartdoc') copytree(dartdoc_src_dir, dartdoc_dest_dir, ignore=ignore_patterns('.svn', 'docs')) # Fixup frog dependencies. ReplaceInFiles([join(LIB, 'dartdoc', 'dartdoc.dart')], [ ("'dart2js'", "joinPaths(scriptDir, '../../bin/dart2js')"), ]) ReplaceInFiles([join(LIB, 'dartdoc', 'frog', 'frog_options.dart')], [ ("final config = \'dev\';", "final config = \'sdk\';") ]) ReplaceInFiles([join(LIB, 'dartdoc', 'frog', 'lib', 'corelib.dart')], [ ("../../../../corelib/src/", "../../../core/runtime/") ]); ReplaceInFiles([join(LIB, 'dartdoc', 'frog', 'lib', 'corelib_impl.dart')], [ ("../../../../corelib/src/implementation", "../../../coreimpl/runtime/") ]); # Create and populate lib/isolate copytree(join(HOME, 'lib', 'isolate'), join(LIB, 'isolate'), ignore=ignore_patterns('.svn')) # # Create and populate lib/core. # # First, copy corelib/* to lib/runtime for filename in corelib_sources: for target_dir in ['runtime']: copyfile(join('corelib', 'src', filename), join(corelib_dest_dir, target_dir, filename)) # Next, copy the runtime library source on top of core/runtime for filename in corelib_runtime_sources: if filename.endswith('.dart'): copyfile(join('runtime', 'lib', filename), join(corelib_dest_dir, 'runtime', filename)) # # At this point, it's time to create lib/core/core*dart . # # construct lib/core_runtime.dart from whole cloth. dest_file = open(join(corelib_dest_dir, 'core_runtime.dart'), 'w') dest_file.write('#library("dart:core");\n') dest_file.write('#import("dart:coreimpl");\n') for filename in corelib_sources: dest_file.write('#source("runtime/' + filename + '");\n') for filename in corelib_runtime_sources: if filename.endswith('.dart'): dest_file.write('#source("runtime/' + filename + '");\n') # include the missing print function dest_file.write('void print(Object arg) { /* native */ }\n') dest_file.close() # # Create and populate lib/coreimpl. # # First, copy corelib/src/implementation to corelib/runtime. for filename in coreimpl_sources: for target_dir in ['runtime']: copyfile(join('corelib', 'src', 'implementation', filename), join(coreimpl_dest_dir, target_dir, filename)) for filename in coreimpl_runtime_sources: if filename.endswith('.dart'): copyfile(join('runtime', 'lib', filename), join(coreimpl_dest_dir, 'runtime', filename)) # Construct lib/coreimpl/coreimpl_runtime.dart from whole cloth. dest_file = open(join(coreimpl_dest_dir, 'coreimpl_runtime.dart'), 'w') dest_file.write('#library("dart:coreimpl");\n') for filename in coreimpl_sources: dest_file.write('#source("runtime/' + filename + '");\n') for filename in coreimpl_runtime_sources: if filename.endswith('.dart'): dest_file.write('#source("runtime/' + filename + '");\n') dest_file.close() # Create and copy tools. UTIL = join(SDK_tmp, 'util') os.makedirs(UTIL) if ShouldCopyAnalyzer(): # 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", "r09", "guava-r09.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 populate util/pub. pub_src_dir = join(HOME, 'utils', 'pub') pub_dst_dir = join(UTIL, 'pub') copytree(pub_src_dir, pub_dst_dir, ignore=ignore_patterns('.svn', 'sdk')) # Copy import maps. PLATFORMS = ['any', 'vm', 'dartium', 'dart2js' ] os.makedirs(join(LIB, 'config')) for platform in PLATFORMS: import_src = join(HOME, 'lib', 'config', 'import_' + platform + '.config') import_dst = join(LIB, 'config', 'import_' + platform + '.config') copyfile(import_src, import_dst); # Copy dart2js. CopyDart2Js(build_dir, SDK_tmp) # 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() move(SDK_tmp, SDK) utils.Touch(os.path.join(SDK, 'create.stamp'))