Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion test/buildbot/builders/unified_cmakeex.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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")
16 changes: 16 additions & 0 deletions zorg/buildbot/builders/UnifiedTreeBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
-------
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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.

Expand Down