From eaa49f7d4e35a5d5da7b0aa9cd5da6e1532a042a Mon Sep 17 00:00:00 2001 From: Vladimir Vereschaka Date: Wed, 5 Nov 2025 13:28:43 -0800 Subject: [PATCH] Add new 'user_prop' argument for UnifiedTreeBuilder.getCmakeExBuildFactory factory. This argument allows factory to defined the user specified properties for the build. These properties can use used to store the common values to repeat them within the multiple CMake arguments as example. --- test/buildbot/builders/unified_cmakeex.py | 15 ++++++++++++++- zorg/buildbot/builders/UnifiedTreeBuilder.py | 16 ++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/test/buildbot/builders/unified_cmakeex.py b/test/buildbot/builders/unified_cmakeex.py index 7f93acf23..f0a9e6e56 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 buildbot.process.properties import zorg @@ -365,3 +367,14 @@ def factory_has_step(f, name, hasarg=None, contains=None): 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.