def BuildStepUntarToolchains(pepperdir, platform, arch, toolchains): buildbot_common.BuildStep('Untar Toolchains') tcname = platform + '_' + arch tmpdir = os.path.join(SRC_DIR, 'out', 'tc_temp') buildbot_common.RemoveDir(tmpdir) buildbot_common.MakeDir(tmpdir) if 'newlib' in toolchains: # Untar the newlib toolchains tarfile = GetNewlibToolchain(platform, arch) buildbot_common.Run([sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile], cwd=NACL_DIR) # Then rename/move it to the pepper toolchain directory srcdir = os.path.join(tmpdir, 'sdk', 'nacl-sdk') newlibdir = os.path.join(pepperdir, 'toolchain', tcname + '_newlib') buildbot_common.Move(srcdir, newlibdir) if 'glibc' in toolchains: # Untar the glibc toolchains tarfile = GetGlibcToolchain(platform, arch) buildbot_common.Run([sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile], cwd=NACL_DIR) # Then rename/move it to the pepper toolchain directory srcdir = os.path.join(tmpdir, 'toolchain', tcname) glibcdir = os.path.join(pepperdir, 'toolchain', tcname + '_glibc') buildbot_common.Move(srcdir, glibcdir) # Untar the pnacl toolchains if 'pnacl' in toolchains: tmpdir = os.path.join(tmpdir, 'pnacl') buildbot_common.RemoveDir(tmpdir) buildbot_common.MakeDir(tmpdir) tarfile = GetPNaClToolchain(platform, arch) buildbot_common.Run([sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile], cwd=NACL_DIR) # Then rename/move it to the pepper toolchain directory pnacldir = os.path.join(pepperdir, 'toolchain', tcname + '_pnacl') buildbot_common.Move(tmpdir, pnacldir) if options.gyp and sys.platform not in ['cygwin', 'win32']: # If the gyp options is specified we install a toolchain # wrapper so that gyp can switch toolchains via a commandline # option. bindir = os.path.join(pepperdir, 'toolchain', tcname, 'bin') wrapper = os.path.join(SDK_SRC_DIR, 'tools', 'compiler-wrapper.py') buildbot_common.MakeDir(bindir) buildbot_common.CopyFile(wrapper, bindir) # Module 'os' has no 'symlink' member (on Windows). # pylint: disable=E1101 os.symlink('compiler-wrapper.py', os.path.join(bindir, 'i686-nacl-g++')) os.symlink('compiler-wrapper.py', os.path.join(bindir, 'i686-nacl-gcc')) os.symlink('compiler-wrapper.py', os.path.join(bindir, 'i686-nacl-ar'))
def BuildStepBuildNaClPorts(pepper_ver, pepperdir): """Build selected naclports in all configurations.""" # TODO(sbc): currently naclports doesn't know anything about # Debug builds so the Debug subfolders are all empty. env = dict(os.environ) env['NACL_SDK_ROOT'] = pepperdir env['PEPPER_DIR'] = os.path.basename(pepperdir) # pepper_NN env['NACLPORTS_NO_ANNOTATE'] = "1" env['NACLPORTS_NO_UPLOAD'] = "1" env['BUILDBOT_GOT_REVISION'] = str(NACLPORTS_REV) build_script = 'build_tools/buildbot_sdk_bundle.sh' buildbot_common.BuildStep('Build naclports') bundle_dir = os.path.join(NACLPORTS_DIR, 'out', 'sdk_bundle') out_dir = os.path.join(bundle_dir, 'pepper_%s' % pepper_ver) # Remove the sdk_bundle directory to remove stale files from previous builds. buildbot_common.RemoveDir(bundle_dir) buildbot_common.Run([build_script], env=env, cwd=NACLPORTS_DIR) # Some naclports do not include a standalone LICENSE/COPYING file # so we explicitly list those here for inclusion. extra_licenses = ('tinyxml/readme.txt', 'jpeg-8d/README', 'zlib-1.2.3/README') src_root = os.path.join(NACLPORTS_DIR, 'out', 'build') output_license = os.path.join(out_dir, 'ports', 'LICENSE') GenerateNotice(src_root, output_license, extra_licenses) readme = os.path.join(out_dir, 'ports', 'README') oshelpers.Copy( ['-v', os.path.join(SDK_SRC_DIR, 'README.naclports'), readme])
def MakeDirectoryOrClobber(pepperdir, dirname, clobber): dirpath = os.path.join(pepperdir, dirname) if clobber: buildbot_common.RemoveDir(dirpath) buildbot_common.MakeDir(dirpath) return dirpath
def CopyExamples(pepperdir, toolchains): buildbot_common.BuildStep('Copy examples') if not os.path.exists(os.path.join(pepperdir, 'tools')): buildbot_common.ErrorExit('Examples depend on missing tools.') if not os.path.exists(os.path.join(pepperdir, 'toolchain')): buildbot_common.ErrorExit('Examples depend on missing toolchains.') exampledir = os.path.join(pepperdir, 'examples') buildbot_common.RemoveDir(exampledir) buildbot_common.MakeDir(exampledir) AddMakeBat(pepperdir, exampledir) # Copy individual files files = ['favicon.ico', 'httpd.cmd', 'httpd.py', 'index.html', 'Makefile'] for filename in files: oshelpers.Copy( ['-v', os.path.join(SDK_EXAMPLE_DIR, filename), exampledir]) # Add examples for supported toolchains examples = [] for tc in toolchains: examples.extend(EXAMPLE_MAP[tc]) for example in examples: buildbot_common.CopyDir(os.path.join(SDK_EXAMPLE_DIR, example), exampledir) AddMakeBat(pepperdir, os.path.join(exampledir, example))
def BuildStepBuildNaClPorts(pepper_ver, pepperdir): """Build selected naclports in all configurations.""" # TODO(sbc): currently naclports doesn't know anything about # Debug builds so the Debug subfolders are all empty. bundle_dir = os.path.join(NACLPORTS_DIR, 'out', 'sdk_bundle') env = dict(os.environ) env['NACL_SDK_ROOT'] = pepperdir env['NACLPORTS_NO_ANNOTATE'] = "1" build_script = 'build_tools/bots/linux/nacl-linux-sdk-bundle.sh' buildbot_common.BuildStep('Build naclports') buildbot_common.Run([build_script], env=env, cwd=NACLPORTS_DIR) out_dir = os.path.join(bundle_dir, 'pepper_XX') out_dir_final = os.path.join(bundle_dir, 'pepper_%s' % pepper_ver) buildbot_common.RemoveDir(out_dir_final) buildbot_common.Move(out_dir, out_dir_final) # Some naclports do not include a standalone LICENSE/COPYING file # so we explicitly list those here for inclusion. extra_licenses = ('tinyxml/readme.txt', 'jpeg-8d/README', 'zlib-1.2.3/README') src_root = os.path.join(NACLPORTS_DIR, 'out', 'repository-i686') output_license = os.path.join(out_dir_final, 'ports', 'LICENSE') GenerateNotice(src_root , output_license, extra_licenses) readme = os.path.join(out_dir_final, 'ports', 'README') oshelpers.Copy(['-v', os.path.join(SDK_SRC_DIR, 'README.naclports'), readme])
def BuildUpdater(): buildbot_common.BuildStep('Create Updater') # Build SDK directory buildbot_common.RemoveDir(os.path.join(OUT_DIR, 'nacl_sdk')) CopyFiles(UPDATER_FILES) # Make zip buildbot_common.RemoveFile(os.path.join(OUT_DIR, 'nacl_sdk.zip')) buildbot_common.Run( [sys.executable, oshelpers.__file__, 'zip', 'nacl_sdk.zip'] + [out_file for in_file, out_file in UPDATER_FILES], cwd=OUT_DIR) # Tar of all files under nacl_sdk/sdk_tools sdktoolsdir = 'nacl_sdk/sdk_tools' tarname = os.path.join(OUT_DIR, 'sdk_tools.tgz') files_to_tar = [ os.path.relpath(out_file, sdktoolsdir) for in_file, out_file in UPDATER_FILES if out_file.startswith(sdktoolsdir) ] buildbot_common.RemoveFile(tarname) buildbot_common.Run([ sys.executable, CYGTAR, '-C', os.path.join(OUT_DIR, sdktoolsdir), '-czf', tarname ] + files_to_tar, cwd=NACL_DIR) sys.stdout.write('\n')
def UpdateHelpers(pepperdir, platform, clobber=False): if not os.path.exists(os.path.join(pepperdir, 'tools')): buildbot_common.ErrorExit('Examples depend on missing tools.') exampledir = os.path.join(pepperdir, 'examples') if clobber: buildbot_common.RemoveDir(exampledir) buildbot_common.MakeDir(exampledir) # Copy files for individual bild and landing page files = ['favicon.ico', 'httpd.cmd'] CopyFilesFromTo(files, SDK_EXAMPLE_DIR, exampledir) resourcesdir = os.path.join(SDK_EXAMPLE_DIR, 'resources') files = [ 'index.css', 'index.js', 'button_close.png', 'button_close_hover.png' ] CopyFilesFromTo(files, resourcesdir, exampledir) # Copy tools scripts and make includes buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.py'), os.path.join(pepperdir, 'tools')) buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.mk'), os.path.join(pepperdir, 'tools')) # On Windows add a prebuilt make if platform == 'win': buildbot_common.BuildStep('Add MAKE') http_download.HttpDownload( GSTORE + MAKE, os.path.join(pepperdir, 'tools', 'make.exe'))
def UpdateHelpers(pepperdir, clobber=False): tools_dir = os.path.join(pepperdir, 'tools') if not os.path.exists(tools_dir): buildbot_common.ErrorExit('SDK tools dir is missing: %s' % tools_dir) exampledir = os.path.join(pepperdir, 'examples') if clobber: buildbot_common.RemoveDir(exampledir) buildbot_common.MakeDir(exampledir) # Copy files for individual build and landing page files = ['favicon.ico', 'httpd.cmd', 'index.css', 'index.js', 'button_close.png', 'button_close_hover.png'] CopyFilesFromTo(files, SDK_RESOURCE_DIR, exampledir) # Copy tools scripts and make includes buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.py'), tools_dir) buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.mk'), tools_dir) # Copy tools/lib scripts tools_lib_dir = os.path.join(pepperdir, 'tools', 'lib') buildbot_common.MakeDir(tools_lib_dir) buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', 'lib', '*.py'), tools_lib_dir) # On Windows add a prebuilt make if getos.GetPlatform() == 'win': buildbot_common.BuildStep('Add MAKE') make_url = posixpath.join(GSTORE, MAKE) make_exe = os.path.join(tools_dir, 'make.exe') with open(make_exe, 'wb') as f: f.write(urllib2.urlopen(make_url).read())
def UpdateHelpers(pepperdir, clobber=False): tools_dir = os.path.join(pepperdir, 'tools') if not os.path.exists(tools_dir): buildbot_common.ErrorExit('SDK tools dir is missing: %s' % tools_dir) exampledir = os.path.join(pepperdir, 'examples') if clobber: buildbot_common.RemoveDir(exampledir) buildbot_common.MakeDir(exampledir) # Copy files for individual build and landing page files = ['favicon.ico', 'httpd.cmd', 'index.css', 'index.js', 'button_close.png', 'button_close_hover.png'] CopyFilesFromTo(files, SDK_RESOURCE_DIR, exampledir) # Copy tools scripts and make includes buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.py'), tools_dir) buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.mk'), tools_dir) # On Windows add a prebuilt make if getos.GetPlatform() == 'win': buildbot_common.BuildStep('Add MAKE') http_download.HttpDownload(GSTORE + MAKE, os.path.join(tools_dir, 'make.exe'))
def BuildStepUntarToolchains(pepperdir, toolchains): buildbot_common.BuildStep('Untar Toolchains') platform = getos.GetPlatform() build_platform = '%s_x86' % platform tmpdir = os.path.join(OUT_DIR, 'tc_temp') buildbot_common.RemoveDir(tmpdir) buildbot_common.MakeDir(tmpdir) # Create a list of extract packages tuples, the first part should be # "$PACKAGE_TARGET/$PACKAGE". The second part should be the destination # directory relative to pepperdir/toolchain. extract_packages = [] for toolchain in toolchains: toolchain_map = TOOLCHAIN_PACKAGE_MAP.get(toolchain, None) if toolchain_map: package_name, tcdir, _ = toolchain_map package_tuple = (os.path.join(build_platform, package_name), tcdir % { 'platform': platform }) extract_packages.append(package_tuple) # On linux we also want to extract the arm_trusted package which contains # the ARM libraries we ship in support of sel_ldr_arm. if platform == 'linux': extract_packages.append((os.path.join(build_platform, 'arm_trusted'), 'arm_trusted')) if extract_packages: # Extract all of the packages into the temp directory. package_names = [ package_tuple[0] for package_tuple in extract_packages ] buildbot_common.Run([ sys.executable, PKGVER, '--packages', ','.join(package_names), '--tar-dir', NACL_TOOLCHAINTARS_DIR, '--dest-dir', tmpdir, 'extract' ]) # Move all the packages we extracted to the correct destination. for package_name, dest_dir in extract_packages: full_src_dir = os.path.join(tmpdir, package_name) full_dst_dir = os.path.join(pepperdir, 'toolchain', dest_dir) buildbot_common.Move(full_src_dir, full_dst_dir) # Cleanup the temporary directory we are no longer using. buildbot_common.RemoveDir(tmpdir)
def BuildStepCleanPepperDirs(pepperdir, pepperdir_old): buildbot_common.BuildStep('Clean Pepper Dirs') dirs_to_remove = (pepperdir, pepperdir_old, os.path.join(OUT_DIR, 'arm_trusted')) for dirname in dirs_to_remove: if os.path.exists(dirname): buildbot_common.RemoveDir(dirname) buildbot_common.MakeDir(pepperdir)
def CopyExamples(pepperdir, toolchains): buildbot_common.BuildStep('Copy examples') if not os.path.exists(os.path.join(pepperdir, 'tools')): buildbot_common.ErrorExit('Examples depend on missing tools.') if not os.path.exists(os.path.join(pepperdir, 'toolchain')): buildbot_common.ErrorExit('Examples depend on missing toolchains.') exampledir = os.path.join(pepperdir, 'examples') buildbot_common.RemoveDir(exampledir) buildbot_common.MakeDir(exampledir) libdir = os.path.join(pepperdir, 'lib') buildbot_common.RemoveDir(libdir) buildbot_common.MakeDir(libdir) plat = getos.GetPlatform() for arch in LIB_DICT[plat]: buildbot_common.MakeDir( os.path.join(libdir, '%s_%s_host' % (plat, arch))) srcdir = os.path.join(pepperdir, 'src') buildbot_common.RemoveDir(srcdir) buildbot_common.MakeDir(srcdir) # Copy individual files files = ['favicon.ico', 'httpd.cmd', 'httpd.py', 'index.html'] for filename in files: oshelpers.Copy( ['-v', os.path.join(SDK_EXAMPLE_DIR, filename), exampledir]) args = ['--dstroot=%s' % pepperdir, '--master'] for toolchain in toolchains: args.append('--' + toolchain) for example in EXAMPLE_LIST: dsc = os.path.join(SDK_EXAMPLE_DIR, example, 'example.dsc') args.append(dsc) for library in LIBRARY_LIST: dsc = os.path.join(SDK_LIBRARY_DIR, library, 'library.dsc') args.append(dsc) if generate_make.main(args): buildbot_common.ErrorExit('Failed to build examples.')
def PrunePNaClToolchain(root): dirs_to_prune = [ 'lib-bc-x86-64', 'usr-bc-x86-64' # TODO(sbc): remove this once its really not needed. # Currently we seem to rely on it at least for <bits/stat.h> #'sysroot', ] for dirname in dirs_to_prune: buildbot_common.RemoveDir(os.path.join(root, dirname))
def UntarToolchains(pepperdir, platform, arch, toolchains): buildbot_common.BuildStep('Untar Toolchains') tcname = platform + '_' + arch tmpdir = os.path.join(SRC_DIR, 'out', 'tc_temp') buildbot_common.RemoveDir(tmpdir) buildbot_common.MakeDir(tmpdir) if 'newlib' in toolchains: # Untar the newlib toolchains tarfile = GetNewlibToolchain(platform, arch) buildbot_common.Run( [sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile], cwd=NACL_DIR) # Then rename/move it to the pepper toolchain directory srcdir = os.path.join(tmpdir, 'sdk', 'nacl-sdk') newlibdir = os.path.join(pepperdir, 'toolchain', tcname + '_newlib') buildbot_common.Move(srcdir, newlibdir) if 'glibc' in toolchains: # Untar the glibc toolchains tarfile = GetGlibcToolchain(platform, arch) buildbot_common.Run( [sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile], cwd=NACL_DIR) # Then rename/move it to the pepper toolchain directory srcdir = os.path.join(tmpdir, 'toolchain', tcname) glibcdir = os.path.join(pepperdir, 'toolchain', tcname + '_glibc') buildbot_common.Move(srcdir, glibcdir) # Untar the pnacl toolchains if 'pnacl' in toolchains: tmpdir = os.path.join(tmpdir, 'pnacl') buildbot_common.RemoveDir(tmpdir) buildbot_common.MakeDir(tmpdir) tarfile = GetPNaClToolchain(platform, arch) buildbot_common.Run( [sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile], cwd=NACL_DIR) # Then rename/move it to the pepper toolchain directory pnacldir = os.path.join(pepperdir, 'toolchain', tcname + '_pnacl') buildbot_common.Move(tmpdir, pnacldir)
def BuildUpdater(): buildbot_common.BuildStep('Create Updater') naclsdkdir = os.path.join(OUT_DIR, 'nacl_sdk') tooldir = os.path.join(naclsdkdir, 'sdk_tools') cachedir = os.path.join(naclsdkdir, 'sdk_cache') buildtoolsdir = os.path.join(SDK_SRC_DIR, 'build_tools') # Build SDK directory buildbot_common.RemoveDir(naclsdkdir) buildbot_common.MakeDir(naclsdkdir) buildbot_common.MakeDir(tooldir) buildbot_common.MakeDir(cachedir) # Copy launch scripts buildbot_common.CopyFile(os.path.join(buildtoolsdir, 'naclsdk'), naclsdkdir) buildbot_common.CopyFile(os.path.join(buildtoolsdir, 'naclsdk.bat'), naclsdkdir) # Copy base manifest json = os.path.join(buildtoolsdir, 'json', 'naclsdk_manifest0.json') buildbot_common.CopyFile(json, os.path.join(cachedir, 'naclsdk_manifest2.json')) # Copy SDK tools sdkupdate = os.path.join(SDK_SRC_DIR, 'build_tools', 'sdk_tools', 'sdk_update.py') license = os.path.join(SDK_SRC_DIR, 'LICENSE') buildbot_common.CopyFile(sdkupdate, tooldir) buildbot_common.CopyFile(license, tooldir) buildbot_common.CopyFile(CYGTAR, tooldir) buildbot_common.RemoveFile(os.path.join(OUT_DIR, 'nacl_sdk.zip')) buildbot_common.Run([ 'zip', '-r', 'nacl_sdk.zip', 'nacl_sdk/naclsdk', 'nacl_sdk/naclsdk.bat', 'nacl_sdk/sdk_tools/LICENSE', 'nacl_sdk/sdk_tools/cygtar.py', 'nacl_sdk/sdk_tools/sdk_update.py', 'nacl_sdk/sdk_cache/naclsdk_manifest2.json' ], cwd=OUT_DIR) args = ['-v', sdkupdate, license, CYGTAR, tooldir] tarname = os.path.join(OUT_DIR, 'sdk_tools.tgz') buildbot_common.RemoveFile(tarname) buildbot_common.Run([ sys.executable, CYGTAR, '-C', tooldir, '-czf', tarname, 'sdk_update.py', 'LICENSE', 'cygtar.py' ], cwd=NACL_DIR) sys.stdout.write('\n')
def main(args): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('-v', '--verbose') parser.add_argument('-o', '--outdir') parser.add_argument('-t', '--toolchain', action='append', dest='toolchains', default=[]) parser.add_argument('--clean', action='store_true') global options options = parser.parse_args(args) if options.clean: buildbot_common.RemoveDir(options.outdir) for toolchain in options.toolchains: ExtractAll(TOOLCHAIN_ARCHIVE_MAPS[toolchain], DOWNLOAD_ARCHIVE_DIR, options.outdir) ExtractAll(TOOLS_ARCHIVE_MAP, DOWNLOAD_ARCHIVE_DIR, options.outdir) Untar(PPAPI_ARCHIVE, EXTRACT_ARCHIVE_DIR) return 0
def BuildUpdater(out_dir, revision_number=None): """Build naclsdk.zip and sdk_tools.tgz in |out_dir|. Args: out_dir: The output directory. revision_number: The revision number of this updater, as an integer. Or None, to use the current Chrome revision.""" buildbot_common.BuildStep('Create Updater') out_dir = os.path.abspath(out_dir) # Build SDK directory buildbot_common.RemoveDir(os.path.join(out_dir, 'nacl_sdk')) updater_files = MakeUpdaterFilesAbsolute(out_dir) updater_files = GlobFiles(updater_files) CopyFiles(updater_files) UpdateRevisionNumber(out_dir, revision_number) out_files = [ os.path.relpath(out_file, out_dir) for _, out_file in updater_files ] # Make zip buildbot_common.RemoveFile(os.path.join(out_dir, 'nacl_sdk.zip')) buildbot_common.Run( [sys.executable, oshelpers.__file__, 'zip', 'nacl_sdk.zip'] + out_files, cwd=out_dir) # Tar of all files under nacl_sdk/sdk_tools sdktoolsdir = os.path.join('nacl_sdk', 'sdk_tools') tarname = os.path.join(out_dir, 'sdk_tools.tgz') files_to_tar = [ os.path.relpath(out_file, sdktoolsdir) for out_file in out_files if out_file.startswith(sdktoolsdir) ] buildbot_common.RemoveFile(tarname) buildbot_common.Run([ sys.executable, CYGTAR, '-C', os.path.join(out_dir, sdktoolsdir), '-czf', tarname ] + files_to_tar) sys.stdout.write('\n')
def BuildStepSyncNaClPorts(): """Pull the pinned revision of naclports from SVN.""" buildbot_common.BuildStep('Sync naclports') # In case a previous non-gclient checkout exists, remove it. # TODO(sbc): remove this once all the build machines # have removed the old checkout if (os.path.exists(NACLPORTS_DIR) and not os.path.exists(os.path.join(NACLPORTS_DIR, 'src'))): buildbot_common.RemoveDir(NACLPORTS_DIR) if not os.path.exists(NACLPORTS_DIR): buildbot_common.MakeDir(NACLPORTS_DIR) # checkout new copy of naclports cmd = ['gclient', 'config', '--name=src', NACLPORTS_URL] buildbot_common.Run(cmd, cwd=NACLPORTS_DIR) # sync to required revision cmd = ['gclient', 'sync', '-R', '-r', 'src@' + str(NACLPORTS_REV)] buildbot_common.Run(cmd, cwd=NACLPORTS_DIR)
def build_and_upload_mono(sdk_revision, pepper_revision, sdk_url, upload_path, args): install_dir = 'naclmono' buildbot_common.RemoveDir(install_dir) revision_opt = ['--sdk-revision', sdk_revision] if sdk_revision else [] url_opt = ['--sdk-url', sdk_url] if sdk_url else [] buildbot_common.Run([ sys.executable, 'nacl-mono-builder.py', '--arch', 'x86-32', '--install-dir', install_dir ] + revision_opt + url_opt + args) buildbot_common.Run([ sys.executable, 'nacl-mono-builder.py', '--arch', 'x86-64', '--install-dir', install_dir ] + revision_opt + url_opt + args) buildbot_common.Run([ sys.executable, 'nacl-mono-archive.py', '--upload-path', upload_path, '--pepper-revision', pepper_revision, '--install-dir', install_dir ] + args)
def BuildStepBuildToolchains(pepperdir, toolchains, build, clean): buildbot_common.BuildStep('SDK Items') if clean: for dirname in glob.glob(os.path.join(OUT_DIR, GNBUILD_DIR + '*')): buildbot_common.RemoveDir(dirname) build = True if build: GnNinjaBuildAll(GNBUILD_DIR) GnNinjaInstall(pepperdir, toolchains) for toolchain in toolchains: if toolchain not in ('host', 'clang-newlib'): InstallNaClHeaders(GetToolchainNaClInclude(pepperdir, toolchain), toolchain) if 'pnacl' in toolchains: # NOTE: gn build all untrusted code in the x86 build build_dir = GetNinjaOutDir('x64') nacl_arches = ['x86', 'x64', 'arm'] for nacl_arch in nacl_arches: shim_file = os.path.join(build_dir, 'clang_newlib_' + nacl_arch, 'obj', 'ppapi', 'native_client', 'src', 'untrusted', 'pnacl_irt_shim', 'libpnacl_irt_shim.a') pnacldir = GetToolchainDir(pepperdir, 'pnacl') pnacl_translator_lib_dir = GetPNaClTranslatorLib( pnacldir, nacl_arch) if not os.path.isdir(pnacl_translator_lib_dir): buildbot_common.ErrorExit('Expected %s directory to exist.' % pnacl_translator_lib_dir) buildbot_common.CopyFile(shim_file, pnacl_translator_lib_dir) InstallNaClHeaders(GetToolchainNaClInclude(pepperdir, 'pnacl', 'x86'), 'pnacl') InstallNaClHeaders(GetToolchainNaClInclude(pepperdir, 'pnacl', 'arm'), 'pnacl')
def BuildStepSyncNaClPorts(): """Pull the pinned revision of naclports from SVN.""" buildbot_common.BuildStep('Sync naclports') # In case a previous svn checkout exists, remove it. # TODO(sbc): remove this once all the build machines # have removed the old checkout if (os.path.exists(NACLPORTS_DIR) and not os.path.exists(os.path.join(NACLPORTS_DIR, '.git'))): buildbot_common.RemoveDir(NACLPORTS_DIR) if not os.path.exists(NACLPORTS_DIR): # checkout new copy of naclports cmd = ['git', 'clone', NACLPORTS_URL, 'naclports'] buildbot_common.Run(cmd, cwd=os.path.dirname(NACLPORTS_DIR)) else: # checkout new copy of naclports buildbot_common.Run(['git', 'fetch'], cwd=NACLPORTS_DIR) # sync to required revision cmd = ['git', 'checkout', str(NACLPORTS_REV)] buildbot_common.Run(cmd, cwd=NACLPORTS_DIR)
def main(args): args = args[1:] buildbot_revision = os.environ.get('BUILDBOT_REVISION', '') assert buildbot_revision sdk_revision = buildbot_revision.split(':')[0] pepper_revision = build_utils.ChromeMajorVersion() install_dir = 'naclmono' buildbot_common.RemoveDir(install_dir) buildbot_common.Run([ sys.executable, 'nacl-mono-builder.py', '--arch', 'x86-32', '--install-dir', install_dir ] + args) buildbot_common.Run([ sys.executable, 'nacl-mono-builder.py', '--arch', 'x86-64', '--install-dir', install_dir ] + args) buildbot_common.Run([ sys.executable, 'nacl-mono-archive.py', '--sdk-revision', sdk_revision, '--pepper-revision', pepper_revision, '--install-dir', install_dir ] + args)
def main(args): parser = optparse.OptionParser() _, args = parser.parse_args(args[1:]) toolchains = ['newlib', 'glibc'] pepper_ver = str(int(build_utils.ChromeMajorVersion())) pepperdir = os.path.join(build_sdk.OUT_DIR, 'pepper_' + pepper_ver) app_dir = os.path.join(build_sdk.OUT_DIR, 'naclsdk_app') app_examples_dir = os.path.join(app_dir, 'examples') sdk_resources_dir = os.path.join(build_sdk.SDK_EXAMPLE_DIR, 'resources') platform = getos.GetPlatform() buildbot_common.RemoveDir(app_dir) buildbot_common.MakeDir(app_dir) GenerateMake(app_dir, toolchains) easy_template.RunTemplateFile( os.path.join(sdk_resources_dir, 'manifest.json.template'), os.path.join(app_examples_dir, 'manifest.json'), {'version': build_utils.ChromeVersionNoTrunk()}) for filename in ['background.js', 'icon128.png']: buildbot_common.CopyFile(os.path.join(sdk_resources_dir, filename), os.path.join(app_examples_dir, filename)) os.environ['NACL_SDK_ROOT'] = pepperdir build_sdk.BuildStepMakeAll(app_dir, platform, 'examples', 'Build Examples', False, False, 'Release') RemoveBuildCruft(app_dir) StripNexes(app_dir, platform, pepperdir) app_zip = os.path.join(app_dir, 'examples.zip') os.chdir(app_examples_dir) oshelpers.Zip([app_zip, '-r', '*']) return 0
def main(args): parser = optparse.OptionParser() parser.add_option('--pnacl', help='Enable pnacl build.', action='store_true', dest='pnacl', default=False) parser.add_option('--examples', help='Rebuild the examples.', action='store_true', dest='examples', default=False) parser.add_option('--update', help='Rebuild the updater.', action='store_true', dest='update', default=False) parser.add_option('--skip-tar', help='Skip generating a tarball.', action='store_true', dest='skip_tar', default=False) parser.add_option('--archive', help='Force the archive step.', action='store_true', dest='archive', default=False) parser.add_option('--release', help='PPAPI release version.', dest='release', default=None) options, args = parser.parse_args(args[1:]) platform = getos.GetPlatform() arch = 'x86' builder_name = os.getenv('BUILDBOT_BUILDERNAME', '') if builder_name.find('pnacl') >= 0 and builder_name.find('sdk') >= 0: options.pnacl = True if options.pnacl: toolchains = ['pnacl'] else: toolchains = ['newlib', 'glibc'] print 'Building: ' + ' '.join(toolchains) skip = options.examples or options.update skip_examples = skip skip_update = skip skip_untar = skip skip_build = skip skip_tar = skip or options.skip_tar if options.examples: skip_examples = False skip_update = not options.update if options.archive and (options.examples or options.skip_tar): parser.error('Incompatible arguments with archive.') pepper_ver = str(int(build_utils.ChromeMajorVersion())) clnumber = lastchange.FetchVersionInfo(None).revision if options.release: pepper_ver = options.release print 'Building PEPPER %s at %s' % (pepper_ver, clnumber) if not skip_build: buildbot_common.BuildStep('Rerun hooks to get toolchains') buildbot_common.Run(['gclient', 'runhooks'], cwd=SRC_DIR, shell=(platform == 'win')) buildbot_common.BuildStep('Clean Pepper Dir') pepperdir = os.path.join(SRC_DIR, 'out', 'pepper_' + pepper_ver) if not skip_untar: buildbot_common.RemoveDir(pepperdir) buildbot_common.MakeDir(os.path.join(pepperdir, 'toolchain')) buildbot_common.MakeDir(os.path.join(pepperdir, 'tools')) buildbot_common.BuildStep('Add Text Files') files = ['AUTHORS', 'COPYING', 'LICENSE', 'NOTICE', 'README'] files = [os.path.join(SDK_SRC_DIR, filename) for filename in files] oshelpers.Copy(['-v'] + files + [pepperdir]) # Clean out the temporary toolchain untar directory if not skip_untar: UntarToolchains(pepperdir, platform, arch, toolchains) if not skip_build: BuildToolchains(pepperdir, platform, arch, pepper_ver, toolchains) buildbot_common.BuildStep('Copy make OS helpers') buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.py'), os.path.join(pepperdir, 'tools')) if platform == 'win': buildbot_common.BuildStep('Add MAKE') http_download.HttpDownload( GSTORE + MAKE, os.path.join(pepperdir, 'tools', 'make.exe')) if not skip_examples: CopyExamples(pepperdir, toolchains) if not skip_tar: buildbot_common.BuildStep('Tar Pepper Bundle') tarname = 'naclsdk_' + platform + '.bz2' if 'pnacl' in toolchains: tarname = 'p' + tarname tarfile = os.path.join(OUT_DIR, tarname) buildbot_common.Run([ sys.executable, CYGTAR, '-C', OUT_DIR, '-cjf', tarfile, 'pepper_' + pepper_ver ], cwd=NACL_DIR) # Archive on non-trybots. if options.archive or '-sdk' in os.environ.get('BUILDBOT_BUILDERNAME', ''): buildbot_common.BuildStep('Archive build') buildbot_common.Archive( tarname, 'nativeclient-mirror/nacl/nacl_sdk/%s' % build_utils.ChromeVersion(), OUT_DIR) if not skip_examples: buildbot_common.BuildStep('Test Build Examples') filelist = os.listdir(os.path.join(pepperdir, 'examples')) for filenode in filelist: dirnode = os.path.join(pepperdir, 'examples', filenode) makefile = os.path.join(dirnode, 'Makefile') if os.path.isfile(makefile): print "\n\nMake: " + dirnode buildbot_common.Run(['make', 'all', '-j8'], cwd=os.path.abspath(dirnode), shell=True) # Build SDK Tools if not skip_update: BuildUpdater() return 0
def InstallHeaders(tc_dst_inc, pepper_ver, tc_name): """Copies NaCl headers to expected locations in the toolchain.""" tc_map = HEADER_MAP[tc_name] for filename in tc_map: src = os.path.join(NACL_DIR, tc_map[filename]) dst = os.path.join(tc_dst_inc, filename) buildbot_common.MakeDir(os.path.dirname(dst)) buildbot_common.CopyFile(src, dst) # Clean out per toolchain ppapi directory ppapi = os.path.join(tc_dst_inc, 'ppapi') buildbot_common.RemoveDir(ppapi) # Copy in c and c/dev headers buildbot_common.MakeDir(os.path.join(ppapi, 'c', 'dev')) buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'c', '*.h'), os.path.join(ppapi, 'c')) buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'c', 'dev', '*.h'), os.path.join(ppapi, 'c', 'dev')) # Run the generator to overwrite IDL files buildbot_common.Run([ sys.executable, 'generator.py', '--wnone', '--cgen', '--release=M' + pepper_ver, '--verbose', '--dstroot=%s/c' % ppapi ], cwd=os.path.join(PPAPI_DIR, 'generators')) # Remove private and trusted interfaces buildbot_common.RemoveDir(os.path.join(ppapi, 'c', 'private')) buildbot_common.RemoveDir(os.path.join(ppapi, 'c', 'trusted')) # Copy in the C++ headers buildbot_common.MakeDir(os.path.join(ppapi, 'cpp', 'dev')) buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'cpp', '*.h'), os.path.join(ppapi, 'cpp')) buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'cpp', 'dev', '*.h'), os.path.join(ppapi, 'cpp', 'dev')) buildbot_common.MakeDir(os.path.join(ppapi, 'utility', 'graphics')) buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'utility', '*.h'), os.path.join(ppapi, 'utility')) buildbot_common.CopyDir( os.path.join(PPAPI_DIR, 'utility', 'graphics', '*.h'), os.path.join(ppapi, 'utility', 'graphics')) # Copy in the gles2 headers buildbot_common.MakeDir(os.path.join(ppapi, 'gles2')) buildbot_common.CopyDir( os.path.join(PPAPI_DIR, 'lib', 'gl', 'gles2', '*.h'), os.path.join(ppapi, 'gles2')) # Copy the EGL headers buildbot_common.MakeDir(os.path.join(tc_dst_inc, 'EGL')) buildbot_common.CopyDir( os.path.join(PPAPI_DIR, 'lib', 'gl', 'include', 'EGL', '*.h'), os.path.join(tc_dst_inc, 'EGL')) # Copy the GLES2 headers buildbot_common.MakeDir(os.path.join(tc_dst_inc, 'GLES2')) buildbot_common.CopyDir( os.path.join(PPAPI_DIR, 'lib', 'gl', 'include', 'GLES2', '*.h'), os.path.join(tc_dst_inc, 'GLES2')) # Copy the KHR headers buildbot_common.MakeDir(os.path.join(tc_dst_inc, 'KHR')) buildbot_common.CopyDir( os.path.join(PPAPI_DIR, 'lib', 'gl', 'include', 'KHR', '*.h'), os.path.join(tc_dst_inc, 'KHR'))
def UpdateProjects(pepperdir, project_tree, toolchains, clobber=False, configs=None, first_toolchain=False): if configs is None: configs = ['Debug', 'Release'] if not os.path.exists(os.path.join(pepperdir, 'tools')): buildbot_common.ErrorExit('Examples depend on missing tools.') if not os.path.exists(os.path.join(pepperdir, 'toolchain')): buildbot_common.ErrorExit('Examples depend on missing toolchains.') ValidateToolchains(toolchains) # Create the library output directories libdir = os.path.join(pepperdir, 'lib') platform = getos.GetPlatform() for config in configs: for arch in LIB_DICT[platform]: dirpath = os.path.join(libdir, '%s_%s_host' % (platform, arch), config) if clobber: buildbot_common.RemoveDir(dirpath) buildbot_common.MakeDir(dirpath) landing_page = None for branch, projects in project_tree.iteritems(): dirpath = os.path.join(pepperdir, branch) if clobber: buildbot_common.RemoveDir(dirpath) buildbot_common.MakeDir(dirpath) targets = [desc['NAME'] for desc in projects] # Generate master make for this branch of projects generate_make.GenerateMasterMakefile(pepperdir, os.path.join(pepperdir, branch), targets) if branch.startswith('examples') and not landing_page: landing_page = LandingPage() # Generate individual projects for desc in projects: srcroot = os.path.dirname(desc['FILEPATH']) generate_make.ProcessProject(pepperdir, srcroot, pepperdir, desc, toolchains, configs=configs, first_toolchain=first_toolchain) if branch.startswith('examples'): landing_page.AddDesc(desc) if landing_page: # Generate the landing page text file. index_html = os.path.join(pepperdir, 'examples', 'index.html') index_template = os.path.join(SDK_RESOURCE_DIR, 'index.html.template') with open(index_html, 'w') as fh: out = landing_page.GeneratePage(index_template) fh.write(out) # Generate top Make for examples targets = ['api', 'demo', 'getting_started', 'tutorial'] targets = [x for x in targets if 'examples/' + x in project_tree] branch_name = 'examples' generate_make.GenerateMasterMakefile(pepperdir, os.path.join(pepperdir, branch_name), targets)
def main(args): parser = optparse.OptionParser() parser.add_option('--arch', help='Target architecture', dest='arch', default='x86-32') parser.add_option('--sdk-revision', help='SDK Revision' ' (default=buildbot revision)', dest='sdk_revision', default=None) parser.add_option('--sdk-url', help='SDK Download URL', dest='sdk_url', default=None) parser.add_option('--install-dir', help='Install Directory', dest='install_dir', default='naclmono') (options, args) = parser.parse_args(args[1:]) assert sys.platform.find('linux') != -1 buildbot_revision = os.environ.get('BUILDBOT_REVISION', '') build_prefix = options.arch + ' ' buildbot_common.BuildStep(build_prefix + 'Clean Old SDK') buildbot_common.MakeDir(MONO_BUILD_DIR) buildbot_common.RemoveDir(os.path.join(MONO_BUILD_DIR, 'pepper_*')) buildbot_common.BuildStep(build_prefix + 'Setup New SDK') sdk_dir = None sdk_revision = options.sdk_revision sdk_url = options.sdk_url if not sdk_url: if not sdk_revision: assert buildbot_revision sdk_revision = buildbot_revision.split(':')[0] sdk_url = 'gs://nativeclient-mirror/nacl/nacl_sdk/'\ 'trunk.%s/naclsdk_linux.bz2' % sdk_revision sdk_url = sdk_url.replace('https://commondatastorage.googleapis.com/', 'gs://') sdk_file = sdk_url.split('/')[-1] buildbot_common.Run([buildbot_common.GetGsutil(), 'cp', sdk_url, sdk_file], cwd=MONO_BUILD_DIR) tar_file = None try: tar_file = tarfile.open(os.path.join(MONO_BUILD_DIR, sdk_file)) pepper_dir = os.path.commonprefix(tar_file.getnames()) tar_file.extractall(path=MONO_BUILD_DIR) sdk_dir = os.path.join(MONO_BUILD_DIR, pepper_dir) finally: if tar_file: tar_file.close() assert sdk_dir buildbot_common.BuildStep(build_prefix + 'Checkout Mono') # TODO(elijahtaylor): Get git URL from master/trigger to make this # more flexible for building from upstream and release branches. git_url = 'git://github.com/elijahtaylor/mono.git' git_rev = 'HEAD' if buildbot_revision: git_rev = buildbot_revision.split(':')[1] if not os.path.exists(MONO_DIR): buildbot_common.MakeDir(MONO_DIR) buildbot_common.Run(['git', 'clone', git_url, MONO_DIR]) else: buildbot_common.Run(['git', 'fetch'], cwd=MONO_DIR) if git_rev: buildbot_common.Run(['git', 'checkout', git_rev], cwd=MONO_DIR) arch_to_bitsize = {'x86-32': '32', 'x86-64': '64'} arch_to_output_folder = { 'x86-32': 'runtime-build', 'x86-64': 'runtime64-build' } buildbot_common.BuildStep(build_prefix + 'Configure Mono') os.environ['NACL_SDK_ROOT'] = sdk_dir os.environ['TARGET_BITSIZE'] = arch_to_bitsize[options.arch] buildbot_common.Run(['./autogen.sh'], cwd=MONO_DIR) buildbot_common.Run(['make', 'distclean'], cwd=MONO_DIR) buildbot_common.BuildStep(build_prefix + 'Build and Install Mono') nacl_interp_script = os.path.join(SDK_BUILD_DIR, 'nacl_interp_loader_mono.sh') os.environ['NACL_INTERP_LOADER'] = nacl_interp_script buildbot_common.Run( [ './nacl-mono-runtime.sh', MONO_DIR, # Mono directory with 'configure' arch_to_output_folder[options.arch], # Build dir options.install_dir ], cwd=SDK_BUILD_DIR) buildbot_common.BuildStep(build_prefix + 'Test Mono') buildbot_common.Run(['make', 'check', '-j8'], cwd=os.path.join(SDK_BUILD_DIR, arch_to_output_folder[options.arch])) return 0
def BuildStepUntarToolchains(pepperdir, toolchains): buildbot_common.BuildStep('Untar Toolchains') platform = getos.GetPlatform() tmpdir = os.path.join(OUT_DIR, 'tc_temp') buildbot_common.RemoveDir(tmpdir) buildbot_common.MakeDir(tmpdir) if 'newlib' in toolchains: # Untar the newlib toolchains tarfile = GetNewlibToolchain() buildbot_common.Run([sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile], cwd=NACL_DIR) # Then rename/move it to the pepper toolchain directory srcdir = os.path.join(tmpdir, 'sdk', 'nacl-sdk') tcname = platform + '_x86_newlib' newlibdir = os.path.join(pepperdir, 'toolchain', tcname) buildbot_common.Move(srcdir, newlibdir) if 'arm' in toolchains: # Copy the existing arm toolchain from native_client tree tcname = platform + '_arm_newlib' arm_toolchain = os.path.join(NACL_DIR, 'toolchain', tcname) arm_toolchain_sdk = os.path.join(pepperdir, 'toolchain', os.path.basename(arm_toolchain)) buildbot_common.CopyDir(arm_toolchain, arm_toolchain_sdk) if 'glibc' in toolchains: # Untar the glibc toolchains tarfile = GetGlibcToolchain() tcname = platform + '_x86_glibc' buildbot_common.Run([sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile], cwd=NACL_DIR) # Then rename/move it to the pepper toolchain directory srcdir = os.path.join(tmpdir, 'toolchain', platform + '_x86') glibcdir = os.path.join(pepperdir, 'toolchain', tcname) buildbot_common.Move(srcdir, glibcdir) # Untar the pnacl toolchains if 'pnacl' in toolchains: tmpdir = os.path.join(tmpdir, 'pnacl') buildbot_common.RemoveDir(tmpdir) buildbot_common.MakeDir(tmpdir) tarfile = GetPNaClToolchain() tcname = platform + '_pnacl' buildbot_common.Run([sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile], cwd=NACL_DIR) # Then rename/move it to the pepper toolchain directory pnacldir = os.path.join(pepperdir, 'toolchain', tcname) buildbot_common.Move(tmpdir, pnacldir) PrunePNaClToolchain(pnacldir) buildbot_common.RemoveDir(tmpdir) if options.gyp and platform != 'win': # If the gyp options is specified we install a toolchain # wrapper so that gyp can switch toolchains via a commandline # option. bindir = os.path.join(pepperdir, 'toolchain', tcname, 'bin') wrapper = os.path.join(SDK_SRC_DIR, 'tools', 'compiler-wrapper.py') buildbot_common.MakeDir(bindir) buildbot_common.CopyFile(wrapper, bindir) # Module 'os' has no 'symlink' member (on Windows). # pylint: disable=E1101 os.symlink('compiler-wrapper.py', os.path.join(bindir, 'i686-nacl-g++')) os.symlink('compiler-wrapper.py', os.path.join(bindir, 'i686-nacl-gcc')) os.symlink('compiler-wrapper.py', os.path.join(bindir, 'i686-nacl-ar'))
def BuildStepCleanPepperDirs(pepperdir, pepperdir_old): buildbot_common.BuildStep('Clean Pepper Dirs') buildbot_common.RemoveDir(pepperdir_old) buildbot_common.RemoveDir(pepperdir) buildbot_common.MakeDir(pepperdir)
def main(args): parser = argparse.ArgumentParser() parser.add_argument('-c', '--channel', help='Channel to display in the name of the package.') # To setup bash completion for this command first install optcomplete # and then add this line to your .bashrc: # complete -F _optcomplete build_app.py try: import optcomplete optcomplete.autocomplete(parser) except ImportError: pass options = parser.parse_args(args) if options.channel: if options.channel not in ('Dev', 'Beta'): parser.error('Unknown channel: %s' % options.channel) toolchains = ['newlib', 'glibc'] pepper_ver = str(int(build_version.ChromeMajorVersion())) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) app_dir = os.path.join(OUT_DIR, 'naclsdk_app') app_examples_dir = os.path.join(app_dir, 'examples') sdk_resources_dir = SDK_RESOURCE_DIR platform = getos.GetPlatform() buildbot_common.RemoveDir(app_dir) buildbot_common.MakeDir(app_dir) # Add some dummy directories so build_projects doesn't complain... buildbot_common.MakeDir(os.path.join(app_dir, 'tools')) buildbot_common.MakeDir(os.path.join(app_dir, 'toolchain')) config = 'Release' filters = {} filters['DISABLE_PACKAGE'] = False filters['EXPERIMENTAL'] = False filters['TOOLS'] = toolchains filters['DEST'] = [ 'examples/api', 'examples/getting_started', 'examples/demo', 'examples/tutorial' ] tree = parse_dsc.LoadProjectTree(SDK_SRC_DIR, include=filters) build_projects.UpdateHelpers(app_dir, clobber=True) build_projects.UpdateProjects(app_dir, tree, clobber=False, toolchains=toolchains, configs=[config], first_toolchain=True) # Collect permissions from each example, and aggregate them. def MergeLists(list1, list2): return list1 + [x for x in list2 if x not in list1] all_permissions = [] all_socket_permissions = [] all_filesystem_permissions = [] for _, project in parse_dsc.GenerateProjects(tree): permissions = project.get('PERMISSIONS', []) all_permissions = MergeLists(all_permissions, permissions) socket_permissions = project.get('SOCKET_PERMISSIONS', []) all_socket_permissions = MergeLists(all_socket_permissions, socket_permissions) filesystem_permissions = project.get('FILESYSTEM_PERMISSIONS', []) all_filesystem_permissions = MergeLists(all_filesystem_permissions, filesystem_permissions) if all_socket_permissions: all_permissions.append({'socket': all_socket_permissions}) if all_filesystem_permissions: all_permissions.append({'fileSystem': all_filesystem_permissions}) pretty_permissions = json.dumps(all_permissions, sort_keys=True, indent=4) for filename in ['background.js', 'icon128.png']: buildbot_common.CopyFile(os.path.join(sdk_resources_dir, filename), os.path.join(app_examples_dir, filename)) os.environ['NACL_SDK_ROOT'] = pepperdir build_projects.BuildProjects(app_dir, tree, deps=False, clean=False, config=config) RemoveBuildCruft(app_dir) StripNexes(app_dir, platform, pepperdir) # Add manifest.json after RemoveBuildCruft... that function removes the # manifest.json files for the individual examples. name = 'Native Client SDK' if options.channel: name += ' (%s)' % options.channel template_dict = { 'name': name, 'channel': options.channel, 'description': 'Native Client SDK examples, showing API use and key concepts.', 'key': False, # manifests with "key" are rejected when uploading to CWS. 'permissions': pretty_permissions, 'version': build_version.ChromeVersionNoTrunk() } easy_template.RunTemplateFile( os.path.join(sdk_resources_dir, 'manifest.json.template'), os.path.join(app_examples_dir, 'manifest.json'), template_dict) app_zip = os.path.join(app_dir, 'examples.zip') os.chdir(app_examples_dir) oshelpers.Zip([app_zip, '-r', '*']) return 0