aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGalina Kistanova <gkistanova@gmail.com>2019-10-20 03:53:16 +0000
committerGalina Kistanova <gkistanova@gmail.com>2019-10-20 03:53:16 +0000
commit51129adb5ae6cd8422d5836ea33b5dbe371036f9 (patch)
tree3b00b32aca9059c73f3f4bea0f2c665adfb7d230
parent16a2adb5f81664b015644b682b2ba0d43002a1cd (diff)
Handle is_legacy_mode in ClangLTOBuilder. Refactored to simplify the code.
git-svn-id: https://llvm.org/svn/llvm-project/zorg/trunk@375353 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--zorg/buildbot/builders/ClangLTOBuilder.py31
1 files changed, 20 insertions, 11 deletions
diff --git a/zorg/buildbot/builders/ClangLTOBuilder.py b/zorg/buildbot/builders/ClangLTOBuilder.py
index 448bcf02..15858ff5 100644
--- a/zorg/buildbot/builders/ClangLTOBuilder.py
+++ b/zorg/buildbot/builders/ClangLTOBuilder.py
@@ -7,6 +7,7 @@ from zorg.buildbot.commands.CmakeCommand import CmakeCommand
from zorg.buildbot.commands.NinjaCommand import NinjaCommand
from zorg.buildbot.conditions.FileConditions import FileDoesNotExist
from zorg.buildbot.process.factory import LLVMBuildFactory
+from zorg.buildbot.builders import UnifiedTreeBuilder
def _addSteps4SystemCompiler(
f,
@@ -64,6 +65,11 @@ def _addSteps4SystemCompiler(
('-DCMAKE_INSTALL_PREFIX=', install_dir),
])
+ if not f.is_legacy_mode:
+ CmakeCommand.applyRequiredOptions(cmake_args, [
+ ('-DLLVM_ENABLE_PROJECTS=', ";".join(f.depends_on_projects)),
+ ])
+
# Note: On this stage we do not care of warnings, as we build with
# a system toolchain and cannot control the environment.
# Warnings are likely, and we ignore them.
@@ -177,6 +183,11 @@ def _addSteps4StagedCompiler(
"-DCMAKE_C_COMPILER=%(workdir)s/" + staged_install + "/bin/clang"
))
+ if not f.is_legacy_mode:
+ CmakeCommand.applyRequiredOptions(cmake_args, [
+ ('-DLLVM_ENABLE_PROJECTS=', ";".join(f.depends_on_projects)),
+ ])
+
# Create configuration files with cmake
f.addStep(CmakeCommand(name="cmake-configure-stage%s" % stage_num,
description=["stage%s cmake configure" % stage_num],
@@ -228,7 +239,8 @@ def getClangWithLTOBuildFactory(
extra_configure_args = None,
compare_last_2_stages = True,
lto = None, # The string gets passed to -flto flag as is. Like -flto=thin.
- env = None):
+ env = None,
+ **kwargs):
# Set defaults
if depends_on_projects:
@@ -262,7 +274,7 @@ def getClangWithLTOBuildFactory(
# Overwrite pre-set items with the given ones, so user can set anything.
merged_env.update(env)
- f = LLVMBuildFactory(
+ f = UnifiedTreeBuilder.getLLVMBuildFactoryAndPrepareForSourcecodeSteps(
depends_on_projects=depends_on_projects,
stage_objdirs=[
"build/stage1",
@@ -276,17 +288,14 @@ def getClangWithLTOBuildFactory(
"install/stage3",
"install/stage4",
],
- staged_compiler_idx = 1)
+ staged_compiler_idx = 1,
+ **kwargs)
- cleanBuildRequested = lambda step: step.build.getProperty("clean") or clean
+ # Consume is_legacy_mode if given.
+ # TODO: Remove this once legacy mode gets dropped.
+ kwargs.pop('is_legacy_mode', None)
- # Do a clean checkout if requested.
- f.addStep(RemoveDirectory(name='clean-src-dir',
- dir=f.llvm_srcdir,
- haltOnFailure=False,
- flunkOnFailure=False,
- doStepIf=cleanBuildRequested,
- ))
+ cleanBuildRequested = lambda step: clean or step.build.getProperty("clean", default=step.build.getProperty("clean_obj"))
# Get the source code.
f.addGetSourcecodeSteps()