def build(self, stage_name, build_dir, jobs=None): self.report_build_step('%s build' % (stage_name,)) self.halt_on_failure() cmd = ['ninja'] if jobs: cmd += ['-j', str(jobs)] util.report_run_cmd(cmd, cwd=build_dir)
def build(self, stage_name, build_dir, jobs=None): self.report_build_step('%s build' % (stage_name, )) self.halt_on_failure() cmd = ['ninja'] if jobs: cmd += ['-j', str(jobs)] util.report_run_cmd(cmd, cwd=build_dir)
def update_sources(self, source_dir, projects, revision, svn='svn'): self.report_build_step('update-sources') self.halt_on_failure() # TODO: This needs to be updated to use the monorepo. # Where to check the project out relative to an LLVM checkout. checkout_locations = { 'llvm': '', 'clang': 'tools/clang', 'lld': 'tools/lld', 'compiler-rt': 'projects/compiler-rt', 'debuginfo-tests': 'projects/debuginfo-tests', } # If the project is named differently in svn, put it here. svn_locations = { 'clang': 'cfe' } svn_uri_pattern = 'https://llvm.org/svn/llvm-project/%s/trunk' for project in projects: # TODO: Fail the build and report an error if we don't know the # checkout location. path = checkout_locations[project] if not path: path = source_dir elif not os.path.isabs(path): path = pjoin(source_dir, path) uri = svn_uri_pattern % (svn_locations.get(project, project),) util.report("Updating %s to %s at %s from %s" % (project, revision, util.shquote(path), uri)) if os.path.exists(pjoin(path, '.svn')): cmd = [svn, 'up', '-r', revision] else: util.mkdirp(path) cmd = [svn, 'co', '-r', revision, uri, '.'] util.report_run_cmd(cmd, cwd=path)
def update_sources(self, source_dir, projects, revision, svn='svn'): self.report_build_step('update-sources') self.halt_on_failure() # TODO: This needs to be updated to use the monorepo. # Where to check the project out relative to an LLVM checkout. checkout_locations = { 'llvm': '', 'clang': 'tools/clang', 'lld': 'tools/lld', 'compiler-rt': 'projects/compiler-rt', } # If the project is named differently in svn, put it here. svn_locations = {'clang': 'cfe'} svn_uri_pattern = 'https://llvm.org/svn/llvm-project/%s/trunk' for project in projects: # TODO: Fail the build and report an error if we don't know the # checkout location. path = checkout_locations[project] if not path: path = source_dir elif not os.path.isabs(path): path = pjoin(source_dir, path) uri = svn_uri_pattern % (svn_locations.get(project, project), ) util.report("Updating %s to %s at %s from %s" % (project, revision, util.shquote(path), uri)) if os.path.exists(pjoin(path, '.svn')): cmd = [svn, 'up', '-r', revision] else: util.mkdirp(path) cmd = [svn, 'co', '-r', revision, uri, '.'] util.report_run_cmd(cmd, cwd=path)
def check(self, stage_name, build_dir, check_targets, jobs=None): self.report_build_step('%s check' % (stage_name, )) self.halt_on_failure() cmd = ['ninja'] if jobs: cmd += ['-j', str(jobs)] cmd += check_targets util.report_run_cmd(cmd, cwd=build_dir)
def check(self, stage_name, build_dir, check_targets, jobs=None): self.report_build_step('%s check' % (stage_name,)) self.halt_on_failure() cmd = ['ninja'] if jobs: cmd += ['-j', str(jobs)] cmd += check_targets util.report_run_cmd(cmd, cwd=build_dir)
def cmake(self, stage_name, build_dir, source_dir, cmake='cmake', cmake_args=None): self.report_build_step('%s cmake' % (stage_name, )) self.halt_on_failure() cmd = [cmake] if cmake_args is not None: cmd += cmake_args cmd += [util.cmake_pjoin(source_dir, 'llvm')] util.mkdirp(build_dir) util.report_run_cmd(cmd, cwd=build_dir)
def cmake( self, stage_name, build_dir, source_dir, cmake='cmake', cmake_args=None): self.report_build_step('%s cmake' % (stage_name,)) self.halt_on_failure() cmd = [cmake] if cmake_args is not None: cmd += cmake_args cmd += [source_dir] util.mkdirp(build_dir) util.report_run_cmd(cmd, cwd=build_dir)
def build(self, stage_name, build_dir, jobs=None): # The basic idea here is to run 'ninja compiler-rt ; ninja clang lld'. # This ensures that portability issues in compiler-rt code are found # first. Then, we only build clang and lld, the primary dependencies of # the sanitizer test suites, to keep cycle time low. This means there # are still some remaining test dependencies (FileCheck) that may be # compiled during the check step, but there shouldn't be that many. self.report_build_step('%s build' % (stage_name,)) self.halt_on_failure() base_cmd = ['ninja'] if jobs: base_cmd += ['-j', str(jobs)] early_targets = ['compiler-rt'] late_targets = ['clang', 'lld'] util.report_run_cmd(base_cmd + early_targets, cwd=build_dir) util.report_run_cmd(base_cmd + late_targets, cwd=build_dir)
def update_sources(self, source_dir, projects, revision, svn='svn'): self.report_build_step('update-sources') self.halt_on_failure() try: for (project, path, uri) in projects: if path is None: path = source_dir elif not os.path.isabs(path): path = pjoin(source_dir, path) util.report("Updating %s to %s at %s from %s" % (project, revision, util.shquote(path), uri)) if os.path.exists(pjoin(path, '.svn')): cmd = [svn, 'up', '-r', revision] else: util.mkdirp(path) cmd = [svn, 'co', '-r', revision, uri, '.'] util.report_run_cmd(cmd, cwd=path) except Exception as e: self.report_step_exception(e) raise
def update_sources(self, source_dir, projects, revision=None, svn='svn'): self.report_build_step('update-sources') self.halt_on_failure() try: for (project, path, uri) in projects: if path is None: path = source_dir elif not os.path.isabs(path): path = pjoin(source_dir, path) util.report( "Updating %s at %s from %s" % (project, util.shquote(path), uri)) if revision is None: revision_args = [] else: revision_args = ['-r', revision] if os.path.exists(pjoin(path, '.svn')): cmd = [svn, 'up'] + revision_args else: util.mkdirp(path) cmd = [svn, 'co'] + revision_args + [uri, '.'] util.report_run_cmd(cmd, cwd=path) except: self.report_step_exception() raise
def run_command(cmd, directory='.'): util.report_run_cmd(cmd, cwd=directory)