def main(args): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('-p', '--platform', help='Test with this platform, instead of the system\'s platform') parser.add_argument('-s', '--sort', action='store_true', help='Sort the file list in place, rather than verifying the contents.') parser.add_argument('rule_file', nargs='?', default=os.path.join(SCRIPT_DIR, 'sdk_files.list')) parser.add_argument('directory_path', nargs='?') options = parser.parse_args(args) if options.sort: SortFile(options.rule_file) return 0 if not options.directory_path: version = build_version.ChromeMajorVersion() options.directory_path = os.path.join(OUT_DIR, 'pepper_%s' % version) if options.platform: if options.platform not in VALID_PLATFORMS: parser.error('Unknown platform: %s' % options.platform) platform = options.platform else: platform = getos.GetPlatform() try: return Verify(options.rule_file, options.directory_path, platform) except ParseException, e: sys.stderr.write('Error parsing rules:\n%s\n' % e) return 1
def main(args): args = args[1:] # Delete global configs that would override the mono builders' configuration. if 'AWS_CREDENTIAL_FILE' in os.environ: del os.environ['AWS_CREDENTIAL_FILE'] if 'BOTO_CONFIG' in os.environ: del os.environ['BOTO_CONFIG'] buildbot_revision = os.environ.get('BUILDBOT_REVISION', '') buildername = os.environ.get('BUILDBOT_BUILDERNAME', '') os.chdir(SCRIPT_DIR) if buildername == 'linux-sdk-mono32': assert buildbot_revision sdk_revision = buildbot_revision.split(':')[0] pepper_revision = build_version.ChromeMajorVersion() build_and_upload_mono(sdk_revision, pepper_revision, None, 'trunk.' + sdk_revision, args) elif buildername == 'linux-sdk-mono64': infos = get_sdk_build_info() for info in infos: # This will put the file in naclmono_19/1/naclmono_19.bz2 for example. upload_path = info['naclmono_name'] + '/' + info['naclmono_rev'] build_and_upload_mono(None, info['pepper_revision'], info['sdk_url'], upload_path, args) update_mono_sdk_json(infos)
def main(args): parser = optparse.OptionParser(usage='%prog <rule file> <directory>') parser.add_option('-p', '--platform', help='Test with this platform, instead of the system\'s platform') parser.add_option('-s', '--sort', action='store_true', help='Sort the file list in place, rather than verifying the contents.') options, args = parser.parse_args(args) if not args: args = [os.path.join(SCRIPT_DIR, 'sdk_files.list')] if options.sort: if not args: parser.error('Expected rule file.') SortFile(args[0]) return 0 if len(args) < 2: version = build_version.ChromeMajorVersion() args.append(os.path.join(OUT_DIR, 'pepper_%s' % version)) rule_path, directory_path = args if options.platform: if options.platform not in VALID_PLATFORMS: parser.error('Unknown platform: %s' % options.platform) platform = options.platform else: platform = getos.GetPlatform() try: return Verify(rule_path, directory_path, platform) except ParseException, e: print >> sys.stderr, 'Error parsing rules:\n', e return 1
def main(args): usage = '%prog [<options>] [<phase...>]' parser = optparse.OptionParser(description=__doc__, usage=usage) parser.add_option('--experimental', help='build experimental tests', action='store_true') parser.add_option('--verbose', help='Verbose output', action='store_true') if 'NACL_SDK_ROOT' in os.environ: # We don't want the currently configured NACL_SDK_ROOT to have any effect # of the build. del os.environ['NACL_SDK_ROOT'] options, args = parser.parse_args(args[1:]) pepper_ver = str(int(build_version.ChromeMajorVersion())) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) toolchains = ['newlib', 'glibc', 'pnacl'] toolchains.append(getos.GetPlatform()) if options.verbose: build_projects.verbose = True phases = [ ('build_examples', StepBuildExamples, pepperdir), ('copy_tests', StepCopyTests, pepperdir, toolchains, options.experimental), ('build_tests', StepBuildTests, pepperdir), ('sel_ldr_tests', StepRunSelLdrTests, pepperdir), ('browser_tests', StepRunBrowserTests, toolchains, options.experimental), ] if args: phase_names = [p[0] for p in phases] for arg in args: if arg not in phase_names: msg = 'Invalid argument: %s\n' % arg msg += 'Possible arguments:\n' for name in phase_names: msg += ' %s\n' % name parser.error(msg.strip()) for phase in phases: phase_name = phase[0] if args and phase_name not in args: continue phase_func = phase[1] phase_args = phase[2:] phase_func(*phase_args) return 0
def UploadArchives(): major_version = build_version.ChromeMajorVersion() chrome_revision = build_version.ChromeRevision() commit_position = build_version.ChromeCommitPosition() git_sha = build_version.ParseCommitPosition(commit_position)[0] short_sha = git_sha[:9] archive_version = '%s-%s-%s' % (major_version, chrome_revision, short_sha) bucket_path = 'native-client-sdk/archives/%s' % archive_version for archive_name in all_archives: buildbot_common.Archive(archive_name, bucket_path, cwd=BUILD_ARCHIVE_DIR, step_link=False) sha1_filename = archive_name + '.sha1' buildbot_common.Archive(sha1_filename, bucket_path, cwd=BUILD_ARCHIVE_DIR, step_link=False)
def main(args): parser = optparse.OptionParser() parser.add_option('--experimental', help='build experimental tests', action='store_true') options, args = parser.parse_args(args[1:]) platform = getos.GetPlatform() pepper_ver = str(int(build_version.ChromeMajorVersion())) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) toolchains = ['newlib', 'glibc', 'pnacl', 'host'] BuildStepBuildExamples(pepperdir, platform) BuildStepCopyTests(pepperdir, toolchains, options.experimental, True) BuildStepBuildTests(pepperdir, platform) return 0
def main(args): args = args[1:] buildbot_revision = os.environ.get('BUILDBOT_REVISION', '') buildername = os.environ.get('BUILDBOT_BUILDERNAME', '') os.chdir(SCRIPT_DIR) if buildername == 'linux-sdk-mono32': assert buildbot_revision sdk_revision = buildbot_revision.split(':')[0] pepper_revision = build_version.ChromeMajorVersion() build_and_upload_mono(sdk_revision, pepper_revision, None, 'trunk.' + sdk_revision, args) elif buildername == 'linux-sdk-mono64': infos = get_sdk_build_info() for info in infos: # This will put the file in naclmono_19/1/naclmono_19.bz2 for example. upload_path = info['naclmono_name'] + '/' + info['naclmono_rev'] build_and_upload_mono(None, info['pepper_revision'], info['sdk_url'], upload_path, args) update_mono_sdk_json(infos)
def main(args): parser = optparse.OptionParser() parser.add_option('--experimental', help='build experimental tests', action='store_true') if 'NACL_SDK_ROOT' in os.environ: # We don't want the currently configured NACL_SDK_ROOT to have any effect # of the build. del os.environ['NACL_SDK_ROOT'] options, args = parser.parse_args(args[1:]) platform = getos.GetPlatform() pepper_ver = str(int(build_version.ChromeMajorVersion())) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) toolchains = ['newlib', 'glibc', 'pnacl'] toolchains.append(platform) BuildStepBuildExamples(pepperdir, platform) BuildStepCopyTests(pepperdir, toolchains, options.experimental) BuildStepBuildTests(pepperdir, platform) return 0
def main(args): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--experimental', help='build experimental tests', action='store_true') parser.add_argument('--sanitizer', help='Run sanitizer (asan/tsan/valgrind) tests', action='store_true') parser.add_argument('--verbose', '-v', help='Verbose output', action='store_true') parser.add_argument('phases', nargs="*") if 'NACL_SDK_ROOT' in os.environ: # We don't want the currently configured NACL_SDK_ROOT to have any effect # of the build. del os.environ['NACL_SDK_ROOT'] # To setup bash completion for this command first install optcomplete # and then add this line to your .bashrc: # complete -F _optcomplete test_sdk.py try: import optcomplete optcomplete.autocomplete(parser) except ImportError: pass options = parser.parse_args(args) pepper_ver = str(int(build_version.ChromeMajorVersion())) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) toolchains = ['clang-newlib', 'newlib', 'glibc', 'pnacl'] toolchains.append(getos.GetPlatform()) if options.verbose: build_projects.verbose = True phases = [ ('build_examples', StepBuildExamples, pepperdir), ('copy_tests', StepCopyTests, pepperdir, toolchains, options.experimental), ('build_tests', StepBuildTests, pepperdir), ('sel_ldr_tests', StepRunSelLdrTests, pepperdir, None), ('browser_tests', StepRunBrowserTests, toolchains, options.experimental), ] if options.sanitizer: if getos.GetPlatform() != 'linux': buildbot_common.ErrorExit('sanitizer tests only run on linux.') phases += [ ('sel_ldr_tests_asan', StepRunSelLdrTests, pepperdir, 'address'), ('sel_ldr_tests_tsan', StepRunSelLdrTests, pepperdir, 'thread'), ('sel_ldr_tests_valgrind', StepRunSelLdrTests, pepperdir, 'valgrind') ] if options.phases: phase_names = [p[0] for p in phases] for arg in options.phases: if arg not in phase_names: msg = 'Invalid argument: %s\n' % arg msg += 'Possible arguments:\n' for name in phase_names: msg += ' %s\n' % name parser.error(msg.strip()) for phase in phases: phase_name = phase[0] if options.phases and phase_name not in options.phases: continue phase_func = phase[1] phase_args = phase[2:] phase_func(*phase_args) return 0
import buildbot_common import build_version import parse_dsc from build_paths import OUT_DIR, SRC_DIR, SDK_SRC_DIR, SCRIPT_DIR sys.path.append(os.path.join(SDK_SRC_DIR, 'tools')) import getos platform = getos.GetPlatform() # TODO(binji): ugly hack -- can I get the browser in a cleaner way? sys.path.append(os.path.join(SRC_DIR, 'chrome', 'test', 'nacl_test_injection')) import find_chrome browser_path = find_chrome.FindChrome(SRC_DIR, ['Debug', 'Release']) pepper_ver = str(int(build_version.ChromeMajorVersion())) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) browser_tester_py = os.path.join(SRC_DIR, 'ppapi', 'native_client', 'tools', 'browser_tester', 'browser_tester.py') ALL_CONFIGS = ['Debug', 'Release'] ALL_TOOLCHAINS = ['newlib', 'glibc', 'pnacl', 'win', 'linux', 'mac'] # Values you can filter by: # name: The name of the test. (e.g. "pi_generator") # config: See ALL_CONFIGS above. # toolchain: See ALL_TOOLCHAINS above. # platform: mac/win/linux. # # All keys must be matched, but any value that matches in a sequence is
def main(argv): parser = optparse.OptionParser() parser.add_option( '-c', '--clobber', help='Clobber project directories before copying new files', action='store_true', default=False) parser.add_option('-b', '--build', help='Build the projects.', action='store_true') parser.add_option( '--config', help='Choose configuration to build (Debug or Release). Builds both ' 'by default') parser.add_option('-x', '--experimental', help='Build experimental projects', action='store_true') parser.add_option( '-t', '--toolchain', help='Build using toolchain. Can be passed more than once.', action='append', default=[]) parser.add_option( '-d', '--dest', help='Select which build destinations (project types) are valid.', action='append') parser.add_option('-v', '--verbose', action='store_true') # To setup bash completion for this command first install optcomplete # and then add this line to your .bashrc: # complete -F _optcomplete build_projects.py try: import optcomplete optcomplete.autocomplete(parser) except ImportError: pass options, args = parser.parse_args(argv[1:]) if 'NACL_SDK_ROOT' in os.environ: # We don't want the currently configured NACL_SDK_ROOT to have any effect # on the build. del os.environ['NACL_SDK_ROOT'] pepper_ver = str(int(build_version.ChromeMajorVersion())) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) if not options.toolchain: # Order matters here: the default toolchain for an example's Makefile will # be the first toolchain in this list that is available in the example. # e.g. If an example supports newlib and glibc, then the default will be # newlib. options.toolchain = ['pnacl', 'newlib', 'glibc', 'host'] if options.experimental: options.toolchain.append('bionic') if 'host' in options.toolchain: options.toolchain.remove('host') options.toolchain.append(getos.GetPlatform()) print 'Adding platform: ' + getos.GetPlatform() ValidateToolchains(options.toolchain) filters = {} if options.toolchain: filters['TOOLS'] = options.toolchain print 'Filter by toolchain: ' + str(options.toolchain) if not options.experimental: filters['EXPERIMENTAL'] = False if options.dest: filters['DEST'] = options.dest print 'Filter by type: ' + str(options.dest) if args: filters['NAME'] = args print 'Filter by name: ' + str(args) try: project_tree = parse_dsc.LoadProjectTree(SDK_SRC_DIR, include=filters) except parse_dsc.ValidationError as e: buildbot_common.ErrorExit(str(e)) parse_dsc.PrintProjectTree(project_tree) UpdateHelpers(pepperdir, clobber=options.clobber) UpdateProjects(pepperdir, project_tree, options.toolchain, clobber=options.clobber) if options.verbose: global verbose verbose = True if options.build: if options.config: configs = [options.config] else: configs = ['Debug', 'Release'] for config in configs: BuildProjects(pepperdir, project_tree, config=config) return 0
def main(args): parser = optparse.OptionParser() parser.add_option('--tar', help='Force the tar step.', action='store_true') parser.add_option('--archive', help='Force the archive step.', action='store_true') parser.add_option('--gyp', help='Use gyp to build examples/libraries/Makefiles.', action='store_true') parser.add_option('--release', help='PPAPI release version.', dest='release', default=None) parser.add_option('--build-ports', help='Build naclport bundle.', action='store_true') parser.add_option('--build-app-engine', help='Build AppEngine demos.', action='store_true') parser.add_option('--experimental', help='build experimental examples and libraries', action='store_true', dest='build_experimental') parser.add_option('--skip-toolchain', help='Skip toolchain untar', action='store_true') parser.add_option('--mac-sdk', help='Set the mac-sdk (e.g. 10.6) to use when building with ninja.') # To setup bash completion for this command first install optcomplete # and then add this line to your .bashrc: # complete -F _optcomplete build_sdk.py try: import optcomplete optcomplete.autocomplete(parser) except ImportError: pass global options options, args = parser.parse_args(args[1:]) generate_make.use_gyp = options.gyp if buildbot_common.IsSDKBuilder(): options.archive = True options.build_ports = True options.build_app_engine = True options.tar = True toolchains = ['newlib', 'glibc', 'arm', 'pnacl', 'host'] print 'Building: ' + ' '.join(toolchains) if options.archive and not options.tar: parser.error('Incompatible arguments with archive.') chrome_version = int(build_version.ChromeMajorVersion()) chrome_revision = build_version.ChromeRevision() nacl_revision = build_version.NaClRevision() pepper_ver = str(chrome_version) pepper_old = str(chrome_version - 1) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) pepperdir_old = os.path.join(OUT_DIR, 'pepper_' + pepper_old) tarname = 'naclsdk_' + getos.GetPlatform() + '.tar.bz2' tarfile = os.path.join(OUT_DIR, tarname) if options.release: pepper_ver = options.release print 'Building PEPPER %s at %s' % (pepper_ver, chrome_revision) if 'NACL_SDK_ROOT' in os.environ: # We don't want the currently configured NACL_SDK_ROOT to have any effect # of the build. del os.environ['NACL_SDK_ROOT'] if not options.skip_toolchain: BuildStepCleanPepperDirs(pepperdir, pepperdir_old) BuildStepMakePepperDirs(pepperdir, ['include', 'toolchain', 'tools']) BuildStepDownloadToolchains() BuildStepUntarToolchains(pepperdir, toolchains) BuildStepBuildToolchains(pepperdir, toolchains) BuildStepUpdateHelpers(pepperdir, True) BuildStepUpdateUserProjects(pepperdir, toolchains, options.build_experimental, True) BuildStepCopyTextFiles(pepperdir, pepper_ver, chrome_revision, nacl_revision) # Ship with libraries prebuilt, so run that first. BuildStepBuildLibraries(pepperdir, 'src') GenerateNotice(pepperdir) # Verify the SDK contains what we expect. BuildStepVerifyFilelist(pepperdir) if options.tar: BuildStepTarBundle(pepper_ver, tarfile) if options.build_ports and getos.GetPlatform() == 'linux': ports_tarfile = os.path.join(OUT_DIR, 'naclports.tar.bz2') BuildStepSyncNaClPorts() BuildStepBuildNaClPorts(pepper_ver, pepperdir) if options.tar: BuildStepTarNaClPorts(pepper_ver, ports_tarfile) if options.build_app_engine and getos.GetPlatform() == 'linux': BuildStepBuildAppEngine(pepperdir, chrome_revision) # Archive on non-trybots. if options.archive: BuildStepArchiveBundle('build', pepper_ver, chrome_revision, nacl_revision, tarfile) if options.build_ports and getos.GetPlatform() == 'linux': BuildStepArchiveBundle('naclports', pepper_ver, chrome_revision, nacl_revision, ports_tarfile) BuildStepArchiveSDKTools() return 0
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
def main(args): parser = optparse.OptionParser() parser.add_option( '--clobber', help='Clobber project directories before copying new files', action='store_true', default=False) parser.add_option('-b', '--build', help='Build the projects.', action='store_true') parser.add_option('-x', '--experimental', help='Build experimental projects', action='store_true') parser.add_option( '-t', '--toolchain', help='Build using toolchain. Can be passed more than once.', action='append', default=[]) parser.add_option( '-d', '--dest', help='Select which build destinations (project types) are valid.', action='append') parser.add_option('-p', '--project', help='Select which projects are valid.', action='append') parser.add_option('-v', '--verbose', action='store_true') options, files = parser.parse_args(args[1:]) if len(files): parser.error('Not expecting files.') return 1 pepper_ver = str(int(build_version.ChromeMajorVersion())) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) platform = getos.GetPlatform() if not options.toolchain: options.toolchain = ['newlib', 'glibc', 'pnacl', 'host'] if 'host' in options.toolchain: options.toolchain.append(platform) print 'Adding platform: ' + platform filters = {} if options.toolchain: filters['TOOLS'] = options.toolchain print 'Filter by toolchain: ' + str(options.toolchain) if not options.experimental: filters['EXPERIMENTAL'] = False if options.dest: filters['DEST'] = options.dest print 'Filter by type: ' + str(options.dest) if options.project: filters['NAME'] = options.project print 'Filter by name: ' + str(options.project) project_tree = parse_dsc.LoadProjectTree(SDK_SRC_DIR, verbose=options.verbose, filters=filters) parse_dsc.PrintProjectTree(project_tree) UpdateHelpers(pepperdir, platform, clobber=options.clobber) UpdateProjects(pepperdir, platform, project_tree, options.toolchain, clobber=options.clobber) if options.build: BuildProjects(pepperdir, platform, project_tree) return 0
def main(args): parser = optparse.OptionParser(description=__doc__) parser.add_option('--nacl-tree-path', help='Path to native client tree for bionic build.', dest='nacl_tree_path') parser.add_option('--qemu', help='Add qemu for ARM.', action='store_true') parser.add_option('--bionic', help='Add bionic build.', action='store_true') parser.add_option('--tar', help='Force the tar step.', action='store_true') parser.add_option('--archive', help='Force the archive step.', action='store_true') parser.add_option('--release', help='PPAPI release version.', dest='release', default=None) parser.add_option('--build-ports', help='Build naclport bundle.', action='store_true') parser.add_option('--build-app-engine', help='Build AppEngine demos.', action='store_true') parser.add_option('--experimental', help='build experimental examples and libraries', action='store_true', dest='build_experimental') parser.add_option('--skip-toolchain', help='Skip toolchain untar', action='store_true') parser.add_option( '--mac-sdk', help='Set the mac-sdk (e.g. 10.6) to use when building with ninja.') parser.add_option( '--no-arm-trusted', action='store_true', help='Disable building of ARM trusted components (sel_ldr, etc).') # To setup bash completion for this command first install optcomplete # and then add this line to your .bashrc: # complete -F _optcomplete build_sdk.py try: import optcomplete optcomplete.autocomplete(parser) except ImportError: pass global options options, args = parser.parse_args(args[1:]) if args: parser.error("Unexpected arguments: %s" % str(args)) if options.nacl_tree_path: options.bionic = True toolchain_build = os.path.join(options.nacl_tree_path, 'toolchain_build') print 'WARNING: Building bionic toolchain from NaCl checkout.' print 'This option builds bionic from the sources currently in the' print 'provided NativeClient checkout, and the results instead of ' print 'downloading a toolchain from the builder. This may result in a' print 'NaCl SDK that can not run on ToT chrome.' print 'NOTE: To clobber you will need to run toolchain_build_bionic.py' print 'directly from the NativeClient checkout.' print '' response = raw_input("Type 'y' and hit enter to continue.\n") if response != 'y' and response != 'Y': print 'Aborting.' return 1 # Get head version of NativeClient tree buildbot_common.BuildStep('Build bionic toolchain.') buildbot_common.Run( [sys.executable, 'toolchain_build_bionic.py', '-f'], cwd=toolchain_build) else: toolchain_build = None if buildbot_common.IsSDKBuilder(): options.archive = True options.build_ports = True # TODO(binji): re-enable app_engine build when the linux builder stops # breaking when trying to git clone from github. # See http://crbug.com/412969. options.build_app_engine = False options.tar = True # NOTE: order matters here. This will be the order that is specified in the # Makefiles; the first toolchain will be the default. toolchains = ['pnacl', 'newlib', 'glibc', 'arm', 'host'] # Changes for experimental bionic builder if options.bionic: toolchains.append('bionic') options.build_ports = False options.build_app_engine = False print 'Building: ' + ' '.join(toolchains) if options.archive and not options.tar: parser.error('Incompatible arguments with archive.') chrome_version = int(build_version.ChromeMajorVersion()) chrome_revision = build_version.ChromeRevision() nacl_revision = build_version.NaClRevision() pepper_ver = str(chrome_version) pepper_old = str(chrome_version - 1) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) pepperdir_old = os.path.join(OUT_DIR, 'pepper_' + pepper_old) if options.bionic: tarname = 'naclsdk_bionic.tar.bz2' else: tarname = 'naclsdk_' + getos.GetPlatform() + '.tar.bz2' tarfile = os.path.join(OUT_DIR, tarname) if options.release: pepper_ver = options.release print 'Building PEPPER %s at %s' % (pepper_ver, chrome_revision) if 'NACL_SDK_ROOT' in os.environ: # We don't want the currently configured NACL_SDK_ROOT to have any effect # of the build. del os.environ['NACL_SDK_ROOT'] if not options.skip_toolchain: BuildStepCleanPepperDirs(pepperdir, pepperdir_old) BuildStepMakePepperDirs(pepperdir, ['include', 'toolchain', 'tools']) BuildStepDownloadToolchains(toolchains) if options.nacl_tree_path: # Instead of untarring, copy the raw bionic toolchain not_bionic = [i for i in toolchains if i != 'bionic'] BuildStepUntarToolchains(pepperdir, not_bionic) tcname = GetToolchainDirName('bionic', 'arm') srcdir = os.path.join(toolchain_build, 'out', tcname) bionicdir = os.path.join(pepperdir, 'toolchain', tcname) oshelpers.Copy(['-r', srcdir, bionicdir]) else: BuildStepUntarToolchains(pepperdir, toolchains) BuildStepBuildToolchains(pepperdir, toolchains) BuildStepUpdateHelpers(pepperdir, True) BuildStepUpdateUserProjects(pepperdir, toolchains, options.build_experimental, True) BuildStepCopyTextFiles(pepperdir, pepper_ver, chrome_revision, nacl_revision) # Ship with libraries prebuilt, so run that first. BuildStepBuildLibraries(pepperdir, 'src') GenerateNotice(pepperdir) # Verify the SDK contains what we expect. if not options.bionic: BuildStepVerifyFilelist(pepperdir) if options.tar: BuildStepTarBundle(pepper_ver, tarfile) if options.build_ports and getos.GetPlatform() == 'linux': ports_tarfile = os.path.join(OUT_DIR, 'naclports.tar.bz2') BuildStepSyncNaClPorts() BuildStepBuildNaClPorts(pepper_ver, pepperdir) if options.tar: BuildStepTarNaClPorts(pepper_ver, ports_tarfile) if options.build_app_engine and getos.GetPlatform() == 'linux': BuildStepBuildAppEngine(pepperdir, chrome_revision) if options.qemu: qemudir = os.path.join(NACL_DIR, 'toolchain', 'linux_arm-trusted') oshelpers.Copy(['-r', qemudir, pepperdir]) # Archive on non-trybots. if options.archive: BuildStepArchiveBundle('build', pepper_ver, chrome_revision, nacl_revision, tarfile) if options.build_ports and getos.GetPlatform() == 'linux': BuildStepArchiveBundle('naclports', pepper_ver, chrome_revision, nacl_revision, ports_tarfile) BuildStepArchiveSDKTools() return 0
def main(args): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--qemu', help='Add qemu for ARM.', action='store_true') parser.add_argument('--tar', help='Force the tar step.', action='store_true') parser.add_argument('--archive', help='Force the archive step.', action='store_true') parser.add_argument('--release', help='PPAPI release version.', dest='release', default=None) parser.add_argument('--build-app-engine', help='Build AppEngine demos.', action='store_true') parser.add_argument('--experimental', help='build experimental examples and libraries', action='store_true', dest='build_experimental') parser.add_argument('--skip-toolchain', help='Skip toolchain untar', action='store_true') parser.add_argument('--no-clean', dest='clean', action='store_false', help="Don't clean gn build directories") parser.add_argument( '--mac-sdk', help='Set the mac-sdk (e.g. 10.6) to use when building with ninja.') parser.add_argument( '--no-arm-trusted', action='store_true', help='Disable building of ARM trusted components (sel_ldr, etc).') parser.add_argument('--no-use-sysroot', action='store_true', help='Disable building against sysroot.') # To setup bash completion for this command first install optcomplete # and then add this line to your .bashrc: # complete -F _optcomplete build_sdk.py try: import optcomplete optcomplete.autocomplete(parser) except ImportError: pass global options options = parser.parse_args(args) buildbot_common.BuildStep('build_sdk') if buildbot_common.IsSDKBuilder(): options.archive = True # TODO(binji): re-enable app_engine build when the linux builder stops # breaking when trying to git clone from github. # See http://crbug.com/412969. options.build_app_engine = False options.tar = True # NOTE: order matters here. This will be the order that is specified in the # Makefiles; the first toolchain will be the default. toolchains = ['pnacl', 'x86_glibc', 'arm_glibc', 'clang-newlib', 'host'] print 'Building: ' + ' '.join(toolchains) platform = getos.GetPlatform() if options.archive and not options.tar: parser.error('Incompatible arguments with archive.') chrome_version = int(build_version.ChromeMajorVersion()) chrome_revision = build_version.ChromeRevision() nacl_revision = build_version.NaClRevision() pepper_ver = str(chrome_version) pepper_old = str(chrome_version - 1) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) pepperdir_old = os.path.join(OUT_DIR, 'pepper_' + pepper_old) tarname = 'naclsdk_%s.tar.bz2' % platform tarfile = os.path.join(OUT_DIR, tarname) if options.release: pepper_ver = options.release print 'Building PEPPER %s at %s' % (pepper_ver, chrome_revision) if 'NACL_SDK_ROOT' in os.environ: # We don't want the currently configured NACL_SDK_ROOT to have any effect # of the build. del os.environ['NACL_SDK_ROOT'] if platform == 'linux': # Linux-only: make sure the debian/stable sysroot image is installed install_script = os.path.join(SRC_DIR, 'build', 'linux', 'sysroot_scripts', 'install-sysroot.py') buildbot_common.Run([sys.executable, install_script, '--arch=arm']) buildbot_common.Run([sys.executable, install_script, '--arch=i386']) buildbot_common.Run([sys.executable, install_script, '--arch=amd64']) if not options.skip_toolchain: BuildStepCleanPepperDirs(pepperdir, pepperdir_old) BuildStepMakePepperDirs(pepperdir, ['include', 'toolchain', 'tools']) BuildStepDownloadToolchains(toolchains) BuildStepUntarToolchains(pepperdir, toolchains) if platform == 'linux': buildbot_common.Move( os.path.join(pepperdir, 'toolchain', 'arm_trusted'), os.path.join(OUT_DIR, 'arm_trusted')) if platform == 'linux': # Linux-only: Copy arm libraries from the arm_trusted package. These are # needed to be able to run sel_ldr_arm under qemu. arm_libs = [ 'lib/arm-linux-gnueabihf/librt.so.1', 'lib/arm-linux-gnueabihf/libpthread.so.0', 'lib/arm-linux-gnueabihf/libgcc_s.so.1', 'lib/arm-linux-gnueabihf/libc.so.6', 'lib/arm-linux-gnueabihf/ld-linux-armhf.so.3', 'lib/arm-linux-gnueabihf/libm.so.6', 'usr/lib/arm-linux-gnueabihf/libstdc++.so.6' ] arm_lib_dir = os.path.join(pepperdir, 'tools', 'lib', 'arm_trusted', 'lib') buildbot_common.MakeDir(arm_lib_dir) for arm_lib in arm_libs: arm_lib = os.path.join(OUT_DIR, 'arm_trusted', arm_lib) buildbot_common.CopyFile(arm_lib, arm_lib_dir) buildbot_common.CopyFile( os.path.join(OUT_DIR, 'arm_trusted', 'qemu-arm'), os.path.join(pepperdir, 'tools')) BuildStepBuildToolchains(pepperdir, toolchains, not options.skip_toolchain, options.clean) BuildStepUpdateHelpers(pepperdir, True) BuildStepUpdateUserProjects(pepperdir, toolchains, options.build_experimental, True) BuildStepCopyTextFiles(pepperdir, pepper_ver, chrome_revision, nacl_revision) # Ship with libraries prebuilt, so run that first. BuildStepBuildLibraries(pepperdir) GenerateNotice(pepperdir) # Verify the SDK contains what we expect. BuildStepVerifyFilelist(pepperdir) if options.tar: BuildStepTarBundle(pepper_ver, tarfile) if platform == 'linux': BuildStepBuildPNaClComponent(pepper_ver, chrome_revision) if options.build_app_engine and platform == 'linux': BuildStepBuildAppEngine(pepperdir, chrome_revision) if options.qemu: qemudir = os.path.join(NACL_DIR, 'toolchain', 'linux_arm-trusted') oshelpers.Copy(['-r', qemudir, pepperdir]) # Archive the results on Google Cloud Storage. if options.archive: BuildStepArchiveBundle('build', pepper_ver, chrome_revision, nacl_revision, tarfile) # Only archive sdk_tools/naclport/pnacl_component on linux. if platform == 'linux': BuildStepArchiveSDKTools() BuildStepArchivePNaClComponent(chrome_revision) return 0
def main(args): parser = optparse.OptionParser() parser.add_option( '-c', '--clobber', help='Clobber project directories before copying new files', action='store_true', default=False) parser.add_option('-b', '--build', help='Build the projects.', action='store_true') parser.add_option( '--config', help='Choose configuration to build (Debug or Release). Builds both ' 'by default') parser.add_option('-x', '--experimental', help='Build experimental projects', action='store_true') parser.add_option( '-t', '--toolchain', help='Build using toolchain. Can be passed more than once.', action='append', default=[]) parser.add_option( '-d', '--dest', help='Select which build destinations (project types) are valid.', action='append') parser.add_option('-p', '--project', help='Select which projects are valid.', action='append') parser.add_option('-v', '--verbose', action='store_true') options, args = parser.parse_args(args[1:]) if args: parser.error('Not expecting any arguments.') if 'NACL_SDK_ROOT' in os.environ: # We don't want the currently configured NACL_SDK_ROOT to have any effect # on the build. del os.environ['NACL_SDK_ROOT'] pepper_ver = str(int(build_version.ChromeMajorVersion())) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) platform = getos.GetPlatform() if not options.toolchain: options.toolchain = ['newlib', 'glibc', 'pnacl', 'host'] if 'host' in options.toolchain: options.toolchain.remove('host') options.toolchain.append(platform) print 'Adding platform: ' + platform ValidateToolchains(options.toolchain) filters = {} if options.toolchain: filters['TOOLS'] = options.toolchain print 'Filter by toolchain: ' + str(options.toolchain) if not options.experimental: filters['EXPERIMENTAL'] = False if options.dest: filters['DEST'] = options.dest print 'Filter by type: ' + str(options.dest) if options.project: filters['NAME'] = options.project print 'Filter by name: ' + str(options.project) project_tree = parse_dsc.LoadProjectTree(SDK_SRC_DIR, filters=filters) parse_dsc.PrintProjectTree(project_tree) UpdateHelpers(pepperdir, platform, clobber=options.clobber) UpdateProjects(pepperdir, platform, project_tree, options.toolchain, clobber=options.clobber) if options.build: if options.config: configs = [options.config] else: configs = ['Debug', 'Release'] for config in configs: BuildProjects(pepperdir, platform, project_tree, config=config) return 0
def main(args): parser = optparse.OptionParser() _, args = parser.parse_args(args[1:]) 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 = os.path.join(SDK_EXAMPLE_DIR, 'resources') 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, filters=filters) build_projects.UpdateHelpers(app_dir, platform, clobber=True) build_projects.UpdateProjects(app_dir, platform, tree, clobber=False, toolchains=toolchains, configs=[config], first_toolchain=True) # Collect permissions from each example, and aggregate them. all_permissions = [] for _, project in parse_dsc.GenerateProjects(tree): all_permissions.extend(project.get('PERMISSIONS', [])) template_dict = { 'name': 'Native Client SDK', 'description': 'Native Client SDK examples, showing API use and key concepts.', 'key': False, # manifests with "key" are rejected when uploading to CWS. 'permissions': all_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) 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, platform, tree, deps=True, clean=False, config=config) 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('--run-tests', help='Run tests. This includes building examples.', action='store_true') parser.add_option('--skip-tar', help='Skip generating a tarball.', action='store_true') parser.add_option('--archive', help='Force the archive step.', action='store_true') parser.add_option('--gyp', help='Use gyp to build examples/libraries/Makefiles.', action='store_true') parser.add_option('--release', help='PPAPI release version.', dest='release', default=None) parser.add_option('--build-ports', help='Build naclport bundle.', action='store_true') parser.add_option('--experimental', help='build experimental examples and libraries', action='store_true', dest='build_experimental') parser.add_option('--skip-toolchain', help='Skip toolchain untar', action='store_true') parser.add_option('--mac_sdk', help='Set the mac_sdk (e.g. 10.6) to use when building with ninja.', dest='mac_sdk') global options options, args = parser.parse_args(args[1:]) platform = getos.GetPlatform() arch = 'x86' generate_make.use_gyp = options.gyp if buildbot_common.IsSDKBuilder(): options.run_tests = True options.archive = True options.build_ports = True if buildbot_common.IsSDKTrybot(): options.run_tests = True toolchains = ['newlib', 'glibc', 'arm', 'pnacl', 'host'] print 'Building: ' + ' '.join(toolchains) if options.archive and options.skip_tar: parser.error('Incompatible arguments with archive.') chrome_version = int(build_version.ChromeMajorVersion()) clnumber = build_version.ChromeRevision() pepper_ver = str(chrome_version) pepper_old = str(chrome_version - 1) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) pepperdir_old = os.path.join(OUT_DIR, 'pepper_' + pepper_old) tarname = 'naclsdk_' + platform + '.tar.bz2' tarfile = os.path.join(OUT_DIR, tarname) if options.release: pepper_ver = options.release print 'Building PEPPER %s at %s' % (pepper_ver, clnumber) if 'NACL_SDK_ROOT' in os.environ: # We don't want the currently configured NACL_SDK_ROOT to have any effect # of the build. del os.environ['NACL_SDK_ROOT'] if options.run_tests: BuildStepRunUnittests() BuildStepCleanPepperDirs(pepperdir, pepperdir_old) BuildStepMakePepperDirs(pepperdir, ['include', 'toolchain', 'tools']) if not options.skip_toolchain: BuildStepDownloadToolchains() BuildStepUntarToolchains(pepperdir, platform, arch, toolchains) BuildStepCopyTextFiles(pepperdir, pepper_ver, clnumber) BuildStepBuildToolchains(pepperdir, platform, toolchains) InstallCommonHeaders(os.path.join(pepperdir, 'include')) BuildStepUpdateHelpers(pepperdir, platform, True) BuildStepUpdateUserProjects(pepperdir, platform, toolchains, options.build_experimental, True) # Ship with libraries prebuilt, so run that first. BuildStepBuildLibraries(pepperdir, platform, 'src') GenerateNotice(pepperdir) if not options.skip_tar: BuildStepTarBundle(pepper_ver, tarfile) if options.build_ports and platform == 'linux': ports_tarfile = os.path.join(OUT_DIR, 'naclports.tar.bz2') BuildStepSyncNaClPorts() BuildStepBuildNaClPorts(pepper_ver, pepperdir) if not options.skip_tar: BuildStepTarNaClPorts(pepper_ver, ports_tarfile) if options.run_tests: BuildStepTestSDK() # Archive on non-trybots. if options.archive: BuildStepArchiveBundle('build', pepper_ver, clnumber, tarfile) if platform == 'linux': BuildStepArchiveBundle('naclports', pepper_ver, clnumber, ports_tarfile) BuildStepArchiveSDKTools() return 0