diff --git a/zorg/buildbot/builders/AnnotatedBuilder.py b/zorg/buildbot/builders/AnnotatedBuilder.py --- a/zorg/buildbot/builders/AnnotatedBuilder.py +++ b/zorg/buildbot/builders/AnnotatedBuilder.py @@ -34,17 +34,16 @@ if clean: f.addStep(SetProperty(property='clean', command='echo 1')) - - # We normally use the clean property to indicate that we want a - # clean build, but AnnotatedCommand uses the clobber property - # instead. Therefore, set clobber if clean is set to a truthy - # value. This will cause AnnotatedCommand to set - # BUILDBOT_CLOBBER=1 in the environment, which is how we - # communicate to the script that we need a clean build. - f.addStep(SetProperty( - property='clobber', - command='echo 1', - doStepIf=lambda step: step.build.getProperty('clean', False))) + # We normally use the clean property to indicate that we want a + # clean build, but AnnotatedCommand uses the clobber property + # instead. Therefore, set clobber if clean is set to a truthy + # value. This will cause AnnotatedCommand to set + # BUILDBOT_CLOBBER=1 in the environment, which is how we + # communicate to the script that we need a clean build. + f.addStep(SetProperty( + property='clobber', + command='echo 1', + doStepIf=lambda step: step.build.getProperty('clean', False))) merged_env = { 'TERM': 'dumb' # Be cautious and disable color output from all tools. diff --git a/zorg/buildbot/builders/LibcBuilder.py b/zorg/buildbot/builders/LibcBuilder.py --- a/zorg/buildbot/builders/LibcBuilder.py +++ b/zorg/buildbot/builders/LibcBuilder.py @@ -1,5 +1,5 @@ -from zorg.buildbot.commands.AnnotatedCommand import AnnotatedCommand -from zorg.buildbot.process.factory import LLVMBuildFactory +from zorg.buildbot.builders import AnnotatedBuilder +from zorg.buildbot.builders.libc import libc_vars LIBC_BUILDER_DIR = "libc_builder" LLVM_ZORG = "%s/llvm-zorg" % LIBC_BUILDER_DIR @@ -8,30 +8,12 @@ def getBuildFactory(clean=False, asan=False, timeout=2400): - f = LLVMBuildFactory(clean=clean, is_legacy_mode=False, - depends_on_projects=["llvm", "libc"]) - - # Get llvm-zorg - f.addGetSourcecodeForProject( - name='checkout-zorg', - project='zorg', - src_dir=LIBC_BUILDER_DIR, - alwaysUseLatest=True) - - additional_env = {} - if clean: - additional_env["BUILDBOT_CLOBBER"] = "1" - - annotated_step_cmd = [ANNOTATED_STEP_RUNNER] - if clean: - annotated_step_cmd.append("--clean") + libc_env = {} if asan: - annotated_step_cmd.append("--asan") + libc_env["LIBC_ASAN_BUILD"] = 1 - f.addStep(AnnotatedCommand(name='run_annotated_steps', - description=["Run annotated steps"], - command=annotated_step_command, - haltOnFailure=True, - timeout=timeout, - env=additional_env)) - return f + return AnnotatedBuilder.getAnnotatedBuildFactory( + script="libc_annotated_step_runner.py", + clean=clean, + depends_on_projects=["llvm", "libc"], + env=libc_env) diff --git a/zorg/buildbot/builders/libc/annotated_step_runner.py b/zorg/buildbot/builders/annotated/libc_annotated_step_runner.py rename from zorg/buildbot/builders/libc/annotated_step_runner.py rename to zorg/buildbot/builders/annotated/libc_annotated_step_runner.py diff --git a/zorg/buildbot/builders/libc/libc_vars.py b/zorg/buildbot/builders/libc/libc_vars.py new file mode 100644 --- /dev/null +++ b/zorg/buildbot/builders/libc/libc_vars.py @@ -0,0 +1 @@ +LIBC_ASAN_BUILD = "LIBC_ASAN_BUILD"