diff --git a/test/buildbot/builders/unified_cmakeex.py b/test/buildbot/builders/unified_cmakeex.py index 5bb2bca9a..c488e3d51 100644 --- a/test/buildbot/builders/unified_cmakeex.py +++ b/test/buildbot/builders/unified_cmakeex.py @@ -1,10 +1,12 @@ # RUN: python %s # Lit Regression Tests for UnifiedTreeBuilder.getCmakeExBuildFactory factory. +# +# Local check cmd: lit -v test/buildbot import sys -from buildbot.plugins import steps +from buildbot.plugins import steps, util import zorg from zorg.buildbot.builders import UnifiedTreeBuilder @@ -302,3 +304,14 @@ assert factory_has_step(f, "cmake-configure-stage-hint") assert factory_has_step(f, "build-default-stage-hint") + +# user proprs +f = UnifiedTreeBuilder.getCmakeExBuildFactory( + user_props = { + "user-prop1" : "myprop", + "user-prop2" : util.Property("srcdir"), + "user-prop3" : util.Interpolate("%(prop:srcdir)s"), + } + ) +print(f"User-prop option: {f}\n") +assert factory_has_step(f, "set-user-props") diff --git a/zorg/buildbot/builders/UnifiedTreeBuilder.py b/zorg/buildbot/builders/UnifiedTreeBuilder.py index ce921b7e8..9aa0dc40d 100644 --- a/zorg/buildbot/builders/UnifiedTreeBuilder.py +++ b/zorg/buildbot/builders/UnifiedTreeBuilder.py @@ -638,6 +638,7 @@ def getCmakeExBuildFactory( jobs = None, # Restrict a degree of parallelism. env = None, # Common environmental variables. hint = None, + user_props = None, # User defined properties for the builder. ): """ Create and configure a builder factory to build a LLVM project from the unified source tree. @@ -829,6 +830,11 @@ def getCmakeExBuildFactory( & etc. Note: cannot be a renderable object. + + user_props: dict, optional + The user defined properties for the builder. + These properties should not have the names of existing properties for the builder + (see the Properties section below and the default buildbot properties docs). Returns ------- @@ -873,6 +879,7 @@ def getCmakeExBuildFactory( assert not post_finalize_steps or isinstance(post_finalize_steps, (list, BuildFactory)), \ "The 'post_finalize_steps' argument must be a list() or BuildFactory()." assert not hint or isinstance(hint, str), "The 'hint' argument must be a str object." + assert not user_props or isinstance(user_props, dict), "The 'user_props' argument must be a dictionary." # This function extends the current workflow with provided custom steps. def extend_with_custom_steps(fc, s): @@ -940,6 +947,15 @@ def norm_target_list_arg(lst): doStepIf = lambda step, clean = clean: clean or step.getProperty("clean_obj") == True ), ]) + + if user_props: + f.addSteps([ + # Set up user defined properties, if specified. + steps.SetProperties( + name = f.makeStepName('set-user-props'), + properties = user_props + ), + ]) # Let's start from getting the source code. We share it between all stages.