Skip to content

Commit e332b21

Browse files
authored
Add new 'user_prop' argument for UnifiedTreeBuilder.getCmakeExBuildFactory factory. (llvm#647)
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.
1 parent 5e1bf82 commit e332b21

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

test/buildbot/builders/unified_cmakeex.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# RUN: python %s
22

33
# Lit Regression Tests for UnifiedTreeBuilder.getCmakeExBuildFactory factory.
4+
#
5+
# Local check cmd: lit -v test/buildbot
46

57
import sys
68

7-
from buildbot.plugins import steps
9+
from buildbot.plugins import steps, util
810

911
import zorg
1012
from zorg.buildbot.builders import UnifiedTreeBuilder
@@ -302,3 +304,14 @@
302304

303305
assert factory_has_step(f, "cmake-configure-stage-hint")
304306
assert factory_has_step(f, "build-default-stage-hint")
307+
308+
# user proprs
309+
f = UnifiedTreeBuilder.getCmakeExBuildFactory(
310+
user_props = {
311+
"user-prop1" : "myprop",
312+
"user-prop2" : util.Property("srcdir"),
313+
"user-prop3" : util.Interpolate("%(prop:srcdir)s"),
314+
}
315+
)
316+
print(f"User-prop option: {f}\n")
317+
assert factory_has_step(f, "set-user-props")

zorg/buildbot/builders/UnifiedTreeBuilder.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@ def getCmakeExBuildFactory(
638638
jobs = None, # Restrict a degree of parallelism.
639639
env = None, # Common environmental variables.
640640
hint = None,
641+
user_props = None, # User defined properties for the builder.
641642
):
642643

643644
""" Create and configure a builder factory to build a LLVM project from the unified source tree.
@@ -829,6 +830,11 @@ def getCmakeExBuildFactory(
829830
& etc.
830831
831832
Note: cannot be a renderable object.
833+
834+
user_props: dict, optional
835+
The user defined properties for the builder.
836+
These properties should not have the names of existing properties for the builder
837+
(see the Properties section below and the default buildbot properties docs).
832838
833839
Returns
834840
-------
@@ -873,6 +879,7 @@ def getCmakeExBuildFactory(
873879
assert not post_finalize_steps or isinstance(post_finalize_steps, (list, BuildFactory)), \
874880
"The 'post_finalize_steps' argument must be a list() or BuildFactory()."
875881
assert not hint or isinstance(hint, str), "The 'hint' argument must be a str object."
882+
assert not user_props or isinstance(user_props, dict), "The 'user_props' argument must be a dictionary."
876883

877884
# This function extends the current workflow with provided custom steps.
878885
def extend_with_custom_steps(fc, s):
@@ -940,6 +947,15 @@ def norm_target_list_arg(lst):
940947
doStepIf = lambda step, clean = clean: clean or step.getProperty("clean_obj") == True
941948
),
942949
])
950+
951+
if user_props:
952+
f.addSteps([
953+
# Set up user defined properties, if specified.
954+
steps.SetProperties(
955+
name = f.makeStepName('set-user-props'),
956+
properties = user_props
957+
),
958+
])
943959

944960
# Let's start from getting the source code. We share it between all stages.
945961

0 commit comments

Comments
 (0)