Exemplo n.º 1
0
def getLLDBCMakeBuildFactory(
        clean=False,
        cmake='cmake',
        jobs="%(jobs)s",

        # Source directory containing a built python
        python_source_dir=None,

        # Default values for VS devenv and build configuration
        vs=None,
        config='Release',
        target_arch='x86',
        extra_cmake_args=None,
        test=False,
        install=False):

    ############# PREPARING
    f = buildbot.process.factory.BuildFactory()

    # Determine Slave Environment and Set MSVC environment.
    if vs:
        f.addStep(
            SetProperty(command=getVisualStudioEnvironment(vs, target_arch),
                        extract_fn=extractSlaveEnvironment))

    f = getLLDBSource(f, 'llvm')

    build_cmd = ['ninja']
    install_cmd = ['ninja', 'install']
    test_cmd = ['ninja', 'check-lldb']

    if jobs:
        build_cmd.append(WithProperties("-j%s" % jobs))
        install_cmd.append(WithProperties("-j%s" % jobs))
        test_cmd.append(WithProperties("-j%s" % jobs))

    # Global configurations
    build_dir = 'build'

    # get full path to build directory
    f.addStep(
        SetProperty(name="get_builddir",
                    command=["pwd"],
                    property="builddir",
                    description="set build dir",
                    workdir=build_dir))

    ############# CLEANING
    cleanBuildRequested = lambda step: step.build.getProperty("clean") or clean
    f.addStep(
        RemoveDirectory(name='clean ' + build_dir,
                        dir=build_dir,
                        haltOnFailure=False,
                        flunkOnFailure=False,
                        doStepIf=cleanBuildRequested))

    cmake_cmd = [
        "cmake", "-G", "Ninja", "../llvm", "-DCMAKE_BUILD_TYPE=" + config,
        "-DCMAKE_INSTALL_PREFIX=../install"
    ]
    if python_source_dir:
        cmake_cmd.append("-DPYTHON_HOME=" + python_source_dir)
    if extra_cmake_args:
        cmake_cmd += extra_cmake_args
    # Note: ShellCommand does not pass the params with special symbols right.
    # The " ".join is a workaround for this bug.
    f.addStep(
        ShellCommand(name="cmake-configure",
                     description=["cmake configure"],
                     command=WithProperties(" ".join(cmake_cmd)),
                     haltOnFailure=True,
                     warnOnWarnings=True,
                     workdir=build_dir,
                     env=Property('slave_env')))

    f.addStep(
        WarningCountingShellCommand(name='build',
                                    command=build_cmd,
                                    haltOnFailure=True,
                                    description='ninja build',
                                    workdir=build_dir,
                                    env=Property('slave_env')))

    ignoreInstallFail = bool(install != 'ignoreFail')
    f.addStep(
        ShellCommand(name='install',
                     command=install_cmd,
                     flunkOnFailure=ignoreInstallFail,
                     description='ninja install',
                     workdir=build_dir,
                     doStepIf=bool(install),
                     env=Property('slave_env')))

    ignoreTestFail = bool(test != 'ignoreFail')
    f.addStep(
        ShellCommand(name='test',
                     command=test_cmd,
                     flunkOnFailure=ignoreTestFail,
                     timeout=2400,
                     description='ninja test',
                     workdir=build_dir,
                     doStepIf=bool(test),
                     env=Property('slave_env')))

    return f
Exemplo n.º 2
0
def getLLDBCMakeBuildFactory(
        clean=False,
        jobs="%(jobs)s",

        # Source directory containing a built python
        python_source_dir=None,

        # Default values for VS devenv and build configuration
        vs=None,
        config='Release',
        target_arch='x86',
        extra_cmake_args=None,
        test=False,
        testTimeout=2400,
        install=False):

    ############# PREPARING

    # Global configurations
    build_dir = 'build'

    f = LLVMBuildFactory(is_legacy_mode=False,
                         depends_on_projects=["llvm", "clang", "lldb", "lld"],
                         obj_dir=build_dir)

    # Determine Slave Environment and Set MSVC environment.
    if vs:
        f.addStep(
            SetProperty(command=getVisualStudioEnvironment(vs, target_arch),
                        extract_fn=extractSlaveEnvironment))

    f.addGetSourcecodeSteps()

    build_cmd = ['ninja']
    install_cmd = ['ninja', 'install']
    test_cmd = ['ninja', 'check-lldb']

    if jobs:
        build_cmd.append(WithProperties("-j%s" % jobs))
        install_cmd.append(WithProperties("-j%s" % jobs))
        test_cmd.append(WithProperties("-j%s" % jobs))

    ############# CLEANING
    cleanBuildRequested = lambda step: clean or step.build.getProperty(
        "clean", default=step.build.getProperty("clean_obj"))
    f.addStep(
        RemoveDirectory(name='clean ' + build_dir,
                        dir=build_dir,
                        haltOnFailure=False,
                        flunkOnFailure=False,
                        doStepIf=cleanBuildRequested))

    rel_src_dir = LLVMBuildFactory.pathRelativeToBuild(f.llvm_srcdir,
                                                       f.obj_dir)
    cmake_options = [
        "-G",
        "Ninja",
        "-DCMAKE_BUILD_TYPE=" + config,
        "-DCMAKE_INSTALL_PREFIX=../install",
        "-DLLVM_ENABLE_PROJECTS=%s" % ";".join(f.depends_on_projects),
    ]
    if python_source_dir:
        cmake_options.append("-DPYTHON_HOME=" + python_source_dir)
    if extra_cmake_args:
        cmake_options += extra_cmake_args

    f.addStep(
        CmakeCommand(name="cmake-configure",
                     description=["cmake configure"],
                     haltOnFailure=True,
                     options=cmake_options,
                     path=rel_src_dir,
                     env=Property('slave_env'),
                     workdir=build_dir))

    f.addStep(
        WarningCountingShellCommand(name='build',
                                    command=build_cmd,
                                    haltOnFailure=True,
                                    description='ninja build',
                                    workdir=build_dir,
                                    env=Property('slave_env')))

    ignoreInstallFail = bool(install != 'ignoreFail')
    f.addStep(
        ShellCommand(name='install',
                     command=install_cmd,
                     flunkOnFailure=ignoreInstallFail,
                     description='ninja install',
                     workdir=build_dir,
                     doStepIf=bool(install),
                     env=Property('slave_env')))

    ignoreTestFail = bool(test != 'ignoreFail')
    f.addStep(
        ShellCommand(name='test',
                     command=test_cmd,
                     flunkOnFailure=ignoreTestFail,
                     timeout=testTimeout,
                     description='ninja test',
                     workdir=build_dir,
                     doStepIf=bool(test),
                     env=Property('slave_env')))

    return f
Exemplo n.º 3
0
def getSanitizerWindowsBuildFactory(
        clean=False,
        cmake='cmake',

        # Default values for VS devenv and build configuration
        vs=r"""%VS120COMNTOOLS%""",
        config='Release',
        target_arch='x86',
        extra_cmake_args=[]):

    ############# PREPARING
    f = buildbot.process.factory.BuildFactory()

    # Kill any stale symbolizer processes for the last run. If there are any
    # stale processes, the build will fail during linking. This can happen to
    # any process, but it is most likely to happen to llvm-symbolizer if its
    # pipe isn't closed.
    taskkill_cmd = 'taskkill /f /im llvm-symbolizer.exe || exit /b 0'
    f.addStep(
        ShellCommand(name='taskkill',
                     description='kill stale processes',
                     command=['cmd', '/c', taskkill_cmd],
                     haltOnFailure=False))

    # Determine Slave Environment and Set MSVC environment.
    f.addStep(
        SetProperty(command=getVisualStudioEnvironment(vs, target_arch),
                    extract_fn=extractSlaveEnvironment))

    f = getSource(f, 'llvm')

    # Global configurations
    build_dir = 'build'

    ############# CLEANING
    cleanBuildRequested = lambda step: step.build.getProperty("clean") or clean
    f.addStep(
        RemoveDirectory(name='clean ' + build_dir,
                        dir=build_dir,
                        haltOnFailure=False,
                        flunkOnFailure=False,
                        doStepIf=cleanBuildRequested))

    f.addStep(
        ShellCommand(
            name='cmake',
            command=[
                cmake, "-G", "Ninja", "../llvm",
                "-DCMAKE_BUILD_TYPE=" + config, "-DLLVM_ENABLE_ASSERTIONS=ON"
            ] + extra_cmake_args,
            haltOnFailure=True,
            workdir=build_dir,
            env=Property('slave_env')))

    # Build compiler-rt first to speed up detection of Windows-specific
    # compiler-time errors in the sanitizer runtimes.
    f.addStep(
        NinjaCommand(name='build compiler-rt',
                     targets=['compiler-rt'],
                     haltOnFailure=True,
                     description='ninja compiler-rt',
                     workdir=build_dir,
                     env=Property('slave_env')))

    # Build Clang and LLD next so that most compilation errors occur in a build
    # step.
    f.addStep(
        NinjaCommand(name='build clang lld',
                     targets=['clang', 'lld'],
                     haltOnFailure=True,
                     description='ninja clang lld',
                     workdir=build_dir,
                     env=Property('slave_env')))

    # Only run sanitizer tests.
    # Don't build targets that are not required in order to speed up the cycle.
    for target in [
            'check-asan', 'check-asan-dynamic', 'check-sanitizer', 'check-cfi'
    ]:
        f.addStep(
            NinjaCommand(name='run %s' % target,
                         targets=[target],
                         haltOnFailure=False,
                         description='ninja %s' % target,
                         workdir=build_dir,
                         env=Property('slave_env')))

    return f
Exemplo n.º 4
0
def getLLDWinBuildFactory(
           clean = True,

           # Default values for VS devenv and build configuration
           vs = r"""%VS140COMNTOOLS%""",   # Visual Studio 2015.
           target_arch = None,             # Native.

           extra_configure_args=[],
           env   = {}):

    llvm_srcdir = "llvm.src"
    llvm_objdir = "llvm.obj"

    f = buildbot.process.factory.BuildFactory()

    # Get LLVM and Lld
    f.addStep(SVN(name='svn-llvm',
                  mode='update',
                  baseURL='http://llvm.org/svn/llvm-project/llvm/',
                  defaultBranch='trunk',
                  workdir=llvm_srcdir))
    f.addStep(SVN(name='svn-lld',
                  mode='update',
                  baseURL='http://llvm.org/svn/llvm-project/lld/',
                  defaultBranch='trunk',
                  workdir='%s/tools/lld' % llvm_srcdir))

    # Clean directory, if requested.
    cleanBuildRequested = lambda step: step.build.getProperty("clean") or clean
    f.addStep(RemoveDirectory(name='clean '+llvm_objdir,
                dir=llvm_objdir,
                haltOnFailure=False,
                flunkOnFailure=False,
                doStepIf=cleanBuildRequested
                ))

    # If set up environment step is requested, do this now.
    if vs:
        f.addStep(SetProperty(
            command=getVisualStudioEnvironment(vs, target_arch),
            extract_fn=extractSlaveEnvironment))
        assert not env, "Can't have custom builder env vars with VS"
        env = Property('slave_env')

    # Always build with ninja.
    cmakeCommand = ["cmake", "-G", "Ninja"]
    # Reconsile configure args with the defaults we want.
    if not any(a.startswith('-DCMAKE_BUILD_TYPE=')   for a in extra_configure_args):
        cmakeCommand.append('-DCMAKE_BUILD_TYPE=Release')
    if not any(a.startswith('-DLLVM_ENABLE_WERROR=') for a in extra_configure_args):
        cmakeCommand.append('-DLLVM_ENABLE_WERROR=ON')
    if not any(a.startswith('-DLLVM_ENABLE_ASSERTIONS=') for a in extra_configure_args):
        cmakeCommand.append('-DLLVM_ENABLE_ASSERTIONS=ON')
    if not any(a.startswith('-DLLVM_LIT_ARGS=') for a in extra_configure_args):
        cmakeCommand.append('-DLLVM_LIT_ARGS=\"-v\"')

    cmakeCommand += extra_configure_args + ["../%s" % llvm_srcdir]

    # Note: ShellCommand does not pass the params with special symbols right.
    # The " ".join is a workaround for this bug.
    f.addStep(ShellCommand(
        name="cmake-configure",
        description=["cmake configure"],
        haltOnFailure=True,
        warnOnWarnings=True,
        command=WithProperties(" ".join(cmakeCommand)),
        env=env,
        workdir=llvm_objdir,
        doStepIf=FileDoesNotExist("./%s/CMakeCache.txt" % llvm_objdir)))

    # Build Lld.
    f.addStep(NinjaCommand(name='build lld',
                           haltOnFailure=True,
                           warnOnWarnings=True,
                           description='build lld',
                           workdir=llvm_objdir,
                           env=env))

    # Test Lld
    f.addStep(NinjaCommand(name='test lld',
                           targets=['lld-test'],
                           haltOnFailure=True,
                           warnOnWarnings=True,
                           description='test lld',
                           workdir=llvm_objdir,
                           env=env))

    return f
Exemplo n.º 5
0
def getLLDBWindowsCMakeBuildFactory(
        clean=False,
        cmake='cmake',
        jobs="%(jobs)s",

        # Source directory containing a built python
        python_source_dir=r'C:/src/python',

        # Default values for VS devenv and build configuration
        vs=r"""%VS120COMNTOOLS%""",
        config='Release',
        target_arch='x86',
        extra_cmake_args=[],
        test=False,
        install=False):

    ############# PREPARING
    f = buildbot.process.factory.BuildFactory()

    # Determine Slave Environment and Set MSVC environment.
    f.addStep(
        SetProperty(command=getVisualStudioEnvironment(vs, target_arch),
                    extract_fn=extractSlaveEnvironment))

    f = getLLDBSource(f, 'llvm')

    build_cmd = ['ninja']
    install_cmd = ['ninja', 'install']
    test_cmd = ['ninja', 'check-lldb']

    if jobs:
        build_cmd.append(WithProperties("-j%s" % jobs))
        install_cmd.append(WithProperties("-j%s" % jobs))
        test_cmd.append(WithProperties("-j%s" % jobs))

    # Global configurations
    build_dir = 'build'

    ############# CLEANING
    cleanBuildRequested = lambda step: step.build.getProperty("clean") or clean
    f.addStep(
        RemoveDirectory(name='clean ' + build_dir,
                        dir=build_dir,
                        haltOnFailure=False,
                        flunkOnFailure=False,
                        doStepIf=cleanBuildRequested))

    if config.lower() == 'release':
        python_lib = 'python27.lib'
        python_exe = 'python.exe'
    elif config.lower() == 'debug':
        python_lib = 'python27_d.lib'
        python_exe = 'python_d.exe'

    python_lib = os.path.join(python_source_dir, 'PCbuild', python_lib)
    python_exe = os.path.join(python_source_dir, 'PCbuild', python_exe)
    python_include = os.path.join(python_source_dir, 'Include')

    # Use batch files instead of ShellCommand directly, Windows quoting is
    # borked. FIXME: See buildbot ticket #595 and buildbot ticket #377.
    f.addStep(
        batch_file_download.BatchFileDownload(
            name='cmakegen',
            command=[
                cmake,
                "-G",
                "Ninja",
                "../llvm",
                "-DCMAKE_BUILD_TYPE=" + config,
                # Need to use our custom built version of python
                '-DPYTHON_LIBRARY=' + python_lib,
                '-DPYTHON_INCLUDE_DIR=' + python_include,
                '-DPYTHON_EXECUTABLE=' + python_exe,
                "-DCMAKE_INSTALL_PREFIX=../install"
            ] + extra_cmake_args,
            workdir=build_dir))

    f.addStep(
        ShellCommand(name='cmake',
                     command=['cmakegen.bat'],
                     haltOnFailure=True,
                     description='cmake gen',
                     workdir=build_dir,
                     env=Property('slave_env')))

    f.addStep(
        WarningCountingShellCommand(name='build',
                                    command=build_cmd,
                                    haltOnFailure=True,
                                    description='ninja build',
                                    workdir=build_dir,
                                    env=Property('slave_env')))

    ignoreInstallFail = bool(install != 'ignoreFail')
    f.addStep(
        ShellCommand(name='install',
                     command=install_cmd,
                     flunkOnFailure=ignoreInstallFail,
                     description='ninja install',
                     workdir=build_dir,
                     doStepIf=bool(install),
                     env=Property('slave_env')))

    ignoreTestFail = bool(test != 'ignoreFail')
    f.addStep(
        ShellCommand(name='test',
                     command=test_cmd,
                     flunkOnFailure=ignoreTestFail,
                     description='ninja test',
                     workdir=build_dir,
                     doStepIf=bool(test),
                     env=Property('slave_env')))

    return f
Exemplo n.º 6
0
def getLLDBCMakeBuildFactory(
            clean=False,
            cmake='cmake',
            jobs="%(jobs)s",

            # Source directory containing a built python
            python_source_dir=None,

            # Default values for VS devenv and build configuration
            vs=None,
            config='Release',
            target_arch='x86',

            extra_cmake_args=None,
            test=False,
            install=False):

    ############# PREPARING
    f = buildbot.process.factory.BuildFactory()

    # Determine Slave Environment and Set MSVC environment.
    if vs:
        f.addStep(SetProperty(
            command=getVisualStudioEnvironment(vs, target_arch),
            extract_fn=extractSlaveEnvironment))

    f = getLLDBSource(f,'llvm')

    build_cmd=['ninja']
    install_cmd = ['ninja','install']
    test_cmd = ['ninja','check-lldb']

    if jobs:
        build_cmd.append(WithProperties("-j%s" % jobs))
        install_cmd.append(WithProperties("-j%s" % jobs))
        test_cmd.append(WithProperties("-j%s" % jobs))

    # Global configurations
    build_dir='build'

    # get full path to build directory
    f.addStep(SetProperty(name="get_builddir",
                          command=["pwd"],
                          property="builddir",
                          description="set build dir",
                          workdir=build_dir))

    ############# CLEANING
    cleanBuildRequested = lambda step: step.build.getProperty("clean") or clean
    f.addStep(RemoveDirectory(name='clean '+build_dir,
                dir=build_dir,
                haltOnFailure=False,
                flunkOnFailure=False,
                doStepIf=cleanBuildRequested
                ))

    cmake_cmd = [
        "cmake", "-G", "Ninja", "../llvm",
        "-DCMAKE_BUILD_TYPE=" + config,
        "-DCMAKE_INSTALL_PREFIX=../install"
        ]
    if python_source_dir:
        cmake_cmd.append("-DPYTHON_HOME=" + python_source_dir)
    if extra_cmake_args:
        cmake_cmd += extra_cmake_args
    # Note: ShellCommand does not pass the params with special symbols right.
    # The " ".join is a workaround for this bug.
    f.addStep(ShellCommand(name="cmake-configure",
                           description=["cmake configure"],
                           command=WithProperties(" ".join(cmake_cmd)),
                           haltOnFailure=True,
                           warnOnWarnings=True,
                           workdir=build_dir,
                           env=Property('slave_env')))

    f.addStep(WarningCountingShellCommand(name='build',
                          command=build_cmd,
                          haltOnFailure=True,
                          description='ninja build',
                          workdir=build_dir,
                          env=Property('slave_env')))

    ignoreInstallFail = bool(install != 'ignoreFail')
    f.addStep(ShellCommand(name='install',
                          command=install_cmd,
                          flunkOnFailure=ignoreInstallFail,
                          description='ninja install',
                          workdir=build_dir,
                          doStepIf=bool(install),
                          env=Property('slave_env')))

    ignoreTestFail = bool(test != 'ignoreFail')
    f.addStep(ShellCommand(name='test',
                          command=test_cmd,
                          flunkOnFailure=ignoreTestFail,
                          timeout=2400,
                          description='ninja test',
                          workdir=build_dir,
                          doStepIf=bool(test),
                          env=Property('slave_env')))

    return f
def getSanitizerWindowsBuildFactory(
            clean=False,
            cmake='cmake',

            # Default values for VS devenv and build configuration
            vs=r"""%VS120COMNTOOLS%""",
            config='Release',
            target_arch='x86',

            extra_cmake_args=[]):

    ############# PREPARING
    f = buildbot.process.factory.BuildFactory()

    # Determine Slave Environment and Set MSVC environment.
    f.addStep(SetProperty(
        command=getVisualStudioEnvironment(vs, target_arch),
        extract_fn=extractSlaveEnvironment))

    f = getSource(f,'llvm')

    # Global configurations
    build_dir='build'

    ############# CLEANING
    cleanBuildRequested = lambda step: step.build.getProperty("clean") or clean
    f.addStep(RemoveDirectory(name='clean '+build_dir,
                dir=build_dir,
                haltOnFailure=False,
                flunkOnFailure=False,
                doStepIf=cleanBuildRequested
                ))

    f.addStep(ShellCommand(name='cmake',
                           command=[cmake, "-G", "Ninja", "../llvm",
                                    "-DCMAKE_BUILD_TYPE="+config,
                                    "-DLLVM_ENABLE_ASSERTIONS=ON"]
                                   + extra_cmake_args,
                           haltOnFailure=True,
                           workdir=build_dir,
                           env=Property('slave_env')))

    # Build compiler-rt first to speed up detection of Windows-specific
    # compiler-time errors in the sanitizers runtime.
    f.addStep(NinjaCommand(name='build compiler-rt',
                           targets=['compiler-rt'],
                           haltOnFailure=True,
                           description='ninja compiler-rt',
                           workdir=build_dir,
                           env=Property('slave_env')))

    # Only run sanitizer tests.
    # Don't build targets that are not required in order to speed up the cycle.
    test_targets = ['check-asan','check-asan-dynamic','check-sanitizer']
    f.addStep(NinjaCommand(name='run tests',
                           targets=test_targets,
                           haltOnFailure=True,
                           description='ninja test',
                           workdir=build_dir,
                           env=Property('slave_env')))

    return f
Exemplo n.º 8
0
def getLLDBWindowsCMakeBuildFactory(
            clean=False,
            cmake='cmake',
            jobs="%(jobs)s",

            # Source directory containing a built python
            python_source_dir=r'C:/Python35',

            # Default values for VS devenv and build configuration
            vs=r"""%VS140COMNTOOLS%""",
            config='Release',
            target_arch='x86',

            extra_cmake_args=[],
            test=False,
            install=False):

    ############# PREPARING
    f = buildbot.process.factory.BuildFactory()

    # Determine Slave Environment and Set MSVC environment.
    f.addStep(SetProperty(
        command=getVisualStudioEnvironment(vs, target_arch),
        extract_fn=extractSlaveEnvironment))

    f = getLLDBSource(f,'llvm')

    build_cmd=['ninja']
    install_cmd = ['ninja','install']
    test_cmd = ['ninja','check-lldb']

    if jobs:
        build_cmd.append(WithProperties("-j%s" % jobs))
        install_cmd.append(WithProperties("-j%s" % jobs))
        test_cmd.append(WithProperties("-j%s" % jobs))

    # Global configurations
    build_dir='build'

    ############# CLEANING
    cleanBuildRequested = lambda step: step.build.getProperty("clean") or clean
    f.addStep(RemoveDirectory(name='clean '+build_dir,
                dir=build_dir,
                haltOnFailure=False,
                flunkOnFailure=False,
                doStepIf=cleanBuildRequested
                ))

    # Use batch files instead of ShellCommand directly, Windows quoting is
    # borked. FIXME: See buildbot ticket #595 and buildbot ticket #377.
    f.addStep(batch_file_download.BatchFileDownload(name='cmakegen',
                                command=[cmake, "-G", "Ninja", "../llvm",
                                         "-DCMAKE_BUILD_TYPE="+config,
                                         '-DPYTHON_HOME=' + python_source_dir,
                                         "-DCMAKE_INSTALL_PREFIX=../install"]
                                         + extra_cmake_args,
                                workdir=build_dir))

    f.addStep(ShellCommand(name='cmake',
                           command=['cmakegen.bat'],
                           haltOnFailure=True,
                           description='cmake gen',
                           workdir=build_dir,
                           env=Property('slave_env')))

    f.addStep(WarningCountingShellCommand(name='build',
                          command=build_cmd,
                          haltOnFailure=True,
                          description='ninja build',
                          workdir=build_dir,
                          env=Property('slave_env')))

    ignoreInstallFail = bool(install != 'ignoreFail')
    f.addStep(ShellCommand(name='install',
                          command=install_cmd,
                          flunkOnFailure=ignoreInstallFail,
                          description='ninja install',
                          workdir=build_dir,
                          doStepIf=bool(install),
                          env=Property('slave_env')))

    ignoreTestFail = bool(test != 'ignoreFail')
    f.addStep(ShellCommand(name='test',
                          command=test_cmd,
                          flunkOnFailure=ignoreTestFail,
                          description='ninja test',
                          workdir=build_dir,
                          doStepIf=bool(test),
                          env=Property('slave_env')))

    return f
Exemplo n.º 9
0
def getLLDWinBuildFactory(
           clean = True,

           # Default values for VS devenv and build configuration
           vs = None,          # What to run to configure Visual Studio utils.
           target_arch = None, # Native.

           extra_configure_args = None,
           env   = None):

    # Set defaults
    if vs is None:
        vs = r"""%VS140COMNTOOLS%"""   # Visual Studio 2015.
    if extra_configure_args is None:
        extra_configure_args = []
    if env is None:
        env = {}

    f = LLVMBuildFactory(
            depends_on_projects=['llvm', 'lld'],
            llvm_srcdir="llvm.src",
            llvm_objdir="llvm.obj")

    # Get LLVM and Lld
    f.addSVNSteps()

    # Clean directory, if requested.
    cleanBuildRequested = lambda step: step.build.getProperty("clean") or clean
    f.addStep(RemoveDirectory(name='clean ' + f.llvm_objdir,
              dir=f.llvm_objdir,
              haltOnFailure=False,
              flunkOnFailure=False,
              doStepIf=cleanBuildRequested
              ))

    # If set up environment step is requested, do this now.
    if vs:
        f.addStep(SetProperty(
            command=getVisualStudioEnvironment(vs, target_arch),
            extract_fn=extractSlaveEnvironment))
        assert not env, "Can't have custom builder env vars with VS"
        env = Property('slave_env')

    # Always build with ninja.
    cmake_options = ["-G", "Ninja"]
    # Reconsile configure args with the defaults we want.
    if not any(a.startswith('-DCMAKE_BUILD_TYPE=')   for a in extra_configure_args):
        cmake_options.append('-DCMAKE_BUILD_TYPE=Release')
    if not any(a.startswith('-DLLVM_ENABLE_WERROR=') for a in extra_configure_args):
        cmake_options.append('-DLLVM_ENABLE_WERROR=ON')
    if not any(a.startswith('-DLLVM_ENABLE_ASSERTIONS=') for a in extra_configure_args):
        cmake_options.append('-DLLVM_ENABLE_ASSERTIONS=ON')
    if not any(a.startswith('-DLLVM_LIT_ARGS=') for a in extra_configure_args):
        cmake_options.append('-DLLVM_LIT_ARGS=\"-v\"')

    cmake_options += extra_configure_args

    # Note: ShellCommand does not pass the params with special symbols right.
    # The " ".join is a workaround for this bug.
    f.addStep(CmakeCommand(name="cmake-configure",
                           description=["cmake configure"],
                           haltOnFailure=True,
                           warnOnWarnings=True,
                           options=cmake_options,
                           path="../%s" % f.llvm_srcdir,
                           env=env,
                           workdir=f.llvm_objdir,
                           doStepIf=FileDoesNotExist(
                                        "./%s/CMakeCache.txt" % f.llvm_objdir)))

    # Build Lld.
    f.addStep(NinjaCommand(name='build lld',
                           haltOnFailure=True,
                           warnOnWarnings=True,
                           description='build lld',
                           workdir=f.llvm_objdir,
                           env=env))

    # Test Lld
    f.addStep(NinjaCommand(name='test lld',
                           targets=['lld-test'],
                           haltOnFailure=True,
                           warnOnWarnings=True,
                           description='test lld',
                           workdir=f.llvm_objdir,
                           env=env))

    return f
def getSanitizerWindowsBuildFactory(
            clean=False,
            cmake='cmake',

            # Default values for VS devenv and build configuration
            vs=r"""%VS120COMNTOOLS%""",
            config='Release',
            target_arch='x86',

            extra_cmake_args=[]):

    ############# PREPARING
    f = buildbot.process.factory.BuildFactory()

    # Determine Slave Environment and Set MSVC environment.
    f.addStep(SetProperty(
        command=getVisualStudioEnvironment(vs, target_arch),
        extract_fn=extractSlaveEnvironment))

    f = getSource(f,'llvm')

    # Global configurations
    build_dir='build'

    ############# CLEANING
    cleanBuildRequested = lambda step: step.build.getProperty("clean") or clean
    f.addStep(RemoveDirectory(name='clean '+build_dir,
                dir=build_dir,
                haltOnFailure=False,
                flunkOnFailure=False,
                doStepIf=cleanBuildRequested
                ))

    f.addStep(ShellCommand(name='cmake',
                           command=[cmake, "-G", "Ninja", "../llvm",
                                    "-DCMAKE_BUILD_TYPE="+config,
                                    "-DLLVM_ENABLE_ASSERTIONS=ON"]
                                   + extra_cmake_args,
                           haltOnFailure=True,
                           workdir=build_dir,
                           env=Property('slave_env')))

    # Build compiler-rt first to speed up detection of Windows-specific
    # compiler-time errors in the sanitizers runtime.
    f.addStep(NinjaCommand(name='build compiler-rt',
                           targets=['compiler-rt'],
                           haltOnFailure=True,
                           description='ninja compiler-rt',
                           workdir=build_dir,
                           env=Property('slave_env')))

    # Only run sanitizer tests.
    # Don't build targets that are not required in order to speed up the cycle.
    test_targets = ['check-asan','check-asan-dynamic','check-sanitizer', 'check-cfi']
    f.addStep(NinjaCommand(name='run tests',
                           targets=test_targets,
                           haltOnFailure=True,
                           description='ninja test',
                           workdir=build_dir,
                           env=Property('slave_env')))

    return f
Exemplo n.º 11
0
def getSanitizerWindowsBuildFactory(
            clean=False,
            cmake='cmake',

            # Default values for VS devenv and build configuration
            vs=r"""%VS120COMNTOOLS%""",
            config='Release',
            target_arch='x86',

            extra_cmake_args=[]):

    ############# PREPARING
    f = buildbot.process.factory.BuildFactory()

    # Kill any stale symbolizer processes for the last run. If there are any
    # stale processes, the build will fail during linking. This can happen to
    # any process, but it is most likely to happen to llvm-symbolizer if its
    # pipe isn't closed.
    taskkill_cmd = 'taskkill /f /im llvm-symbolizer.exe || exit /b 0'
    f.addStep(ShellCommand(name='taskkill',
                           description='kill stale processes',
                           command=['cmd', '/c', taskkill_cmd],
                           haltOnFailure=False))

    # Determine Slave Environment and Set MSVC environment.
    f.addStep(SetProperty(
        command=getVisualStudioEnvironment(vs, target_arch),
        extract_fn=extractSlaveEnvironment))

    f = getSource(f,'llvm')

    # Global configurations
    build_dir = 'build'

    ############# CLEANING
    cleanBuildRequested = lambda step: step.build.getProperty("clean") or clean
    f.addStep(RemoveDirectory(name='clean '+build_dir,
                dir=build_dir,
                haltOnFailure=False,
                flunkOnFailure=False,
                doStepIf=cleanBuildRequested
                ))

    f.addStep(ShellCommand(name='cmake',
                           command=[cmake, "-G", "Ninja", "../llvm",
                                    "-DCMAKE_BUILD_TYPE="+config,
                                    "-DLLVM_ENABLE_ASSERTIONS=ON"]
                                   + extra_cmake_args,
                           haltOnFailure=True,
                           workdir=build_dir,
                           env=Property('slave_env')))

    # Build compiler-rt first to speed up detection of Windows-specific
    # compiler-time errors in the sanitizer runtimes.
    f.addStep(NinjaCommand(name='build compiler-rt',
                           targets=['compiler-rt'],
                           haltOnFailure=True,
                           description='ninja compiler-rt',
                           workdir=build_dir,
                           env=Property('slave_env')))

    # Build Clang and LLD next so that most compilation errors occur in a build
    # step.
    f.addStep(NinjaCommand(name='build clang lld',
                           targets=['clang', 'lld'],
                           haltOnFailure=True,
                           description='ninja clang lld',
                           workdir=build_dir,
                           env=Property('slave_env')))

    # Only run sanitizer tests.
    # Don't build targets that are not required in order to speed up the cycle.
    for target in ['check-asan', 'check-asan-dynamic', 'check-sanitizer',
                   'check-cfi']:
      f.addStep(NinjaCommand(name='run %s' % target,
                             targets=[ target ],
                             haltOnFailure=False,
                             description='ninja %s' % target,
                             workdir=build_dir,
                             env=Property('slave_env')))

    return f