Skip to content

Commit ae2c242

Browse files
authored
Add new 'hint' argument for UnifiedTreeBuilder.getCmakeExBuildFactory() factory. (#228)
This argument can be used to apply suffixes to the step names when factory is used as a nested factory for another one. The suffix will be added to the step name separated by dash symbol.
1 parent aa6a5e4 commit ae2c242

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

zorg/buildbot/builders/UnifiedTreeBuilder.py

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,7 @@ def getCmakeExBuildFactory(
620620
post_finalize_steps = None,
621621
jobs = None, # Restrict a degree of parallelism.
622622
env = None, # Common environmental variables.
623+
hint = None,
623624
):
624625

625626
""" Create and configure a builder factory to build a LLVM project from the unified source tree.
@@ -789,6 +790,15 @@ def getCmakeExBuildFactory(
789790
env : dict, optional
790791
Common environmental variables for all build steps (default is None).
791792
793+
hint : string, optional
794+
Use this hint to apply suffixes to the step names when factory is used as a nested factory for another one.
795+
The suffix will be added to the step name separated by dash symbol.
796+
797+
As example, passing of 'stageX' with 'hint' will force generating of the following step names:
798+
cmake-cofigure => cmake-configure-stageX
799+
build => build-stageX
800+
install => install-stageX
801+
& etc.
792802
793803
Returns
794804
-------
@@ -866,6 +876,7 @@ def norm_target_list_arg(lst):
866876
f = LLVMBuildFactory(
867877
depends_on_projects = depends_on_projects,
868878
enable_runtimes = enable_runtimes,
879+
hint = hint,
869880
llvm_srcdir = llvm_srcdir,
870881
src_to_build_dir = src_to_build_dir,
871882
obj_dir = obj_dir,
@@ -875,7 +886,7 @@ def norm_target_list_arg(lst):
875886
f.addSteps([
876887
# Set up some properties, which could be used to configure the builders.
877888
steps.SetProperties(
878-
name = 'set-props',
889+
name = f.makeStepName('set-props'),
879890
properties = {
880891
"depends_on_projects" : ";".join(sorted(f.depends_on_projects)),
881892
"enable_projects" : ";".join(sorted(f.enable_projects)),
@@ -889,7 +900,7 @@ def norm_target_list_arg(lst):
889900
# This is an incremental build, unless otherwise has been requested.
890901
# Remove obj dirs for a clean build.
891902
steps.RemoveDirectory(
892-
name = 'clean-obj-dir',
903+
name = f.makeStepName('clean-obj-dir'),
893904
dir = util.Interpolate(f.obj_dir),
894905
description = ["Remove", util.Interpolate(f.obj_dir), "directory"],
895906
haltOnFailure = False,
@@ -926,7 +937,7 @@ def norm_target_list_arg(lst):
926937
if vs:
927938
f.addStep(
928939
steps.SetPropertyFromCommand(
929-
name = "set-props.vs_env",
940+
name = f.makeStepName("set-props.vs_env"),
930941
command = builders_util.getVisualStudioEnvironment(vs, vs_arch),
931942
extract_fn = builders_util.extractVSEnvironment,
932943
env = env
@@ -952,7 +963,7 @@ def norm_target_list_arg(lst):
952963
# Remove install directory.
953964
f.addSteps([
954965
steps.RemoveDirectory(
955-
name = f"clean-install-dir",
966+
name = f.makeStepName("clean-install-dir"),
956967
dir = util.Interpolate(f.install_dir),
957968
description = ["Remove", util.Interpolate(f.install_dir), "directory"],
958969
haltOnFailure = False,
@@ -972,7 +983,7 @@ def norm_target_list_arg(lst):
972983

973984
f.addStep(
974985
steps.CMake(
975-
name = f"cmake-configure",
986+
name = f.makeStepName("cmake-configure"),
976987
path = LLVMBuildFactory.pathRelativeTo(f.llvm_srcdir, f.obj_dir),
977988
generator = generator,
978989
definitions = cmake_definitions,
@@ -983,6 +994,7 @@ def norm_target_list_arg(lst):
983994
workdir = f.obj_dir
984995
))
985996

997+
hint_suffix = f"-{hint}" if hint else None
986998
# Build Commands.
987999
#NOTE: please note that the default target (.) cannot be specified by the IRenderable object.
9881000
for target in targets:
@@ -996,7 +1008,8 @@ def norm_target_list_arg(lst):
9961008

9971009
f.addStep(
9981010
steps.CMake(
999-
name = util.Interpolate("build-%(kw:title)s", title = target_title),
1011+
name = util.Interpolate("build-%(kw:title)s%(kw:hint:-)s",
1012+
title = target_title, hint = hint_suffix),
10001013
options = cmake_build_options,
10011014
description = ["Build target", target_title],
10021015
haltOnFailure = True,
@@ -1012,7 +1025,8 @@ def norm_target_list_arg(lst):
10121025
for target in checks:
10131026
f.addStep(
10141027
LitTestCommand(
1015-
name = util.Interpolate("test-%(kw:title)s", title = target),
1028+
name = util.Interpolate("test-%(kw:title)s%(kw:hint:-)s",
1029+
title = target, hint = hint_suffix),
10161030
command = [steps.CMake.DEFAULT_CMAKE, "--build", ".", "--target", target],
10171031
description = ["Test just built components:", target],
10181032
descriptionDone = ["Test just built components:", target, "completed"],
@@ -1025,7 +1039,8 @@ def norm_target_list_arg(lst):
10251039
for target, cmd in checks_on_target:
10261040
f.addStep(
10271041
LitTestCommand(
1028-
name = util.Interpolate("test-%(kw:title)s", title = target),
1042+
name = util.Interpolate("test-%(kw:title)s%(kw:hint:-)s",
1043+
title = target, hint = hint_suffix),
10291044
command = cmd,
10301045
description = ["Test just built components:", target],
10311046
descriptionDone = ["Test just built components:", target, "completed"],
@@ -1044,7 +1059,7 @@ def norm_target_list_arg(lst):
10441059
f.addStep(
10451060
steps.CMake(
10461061
name = util.Transform(lambda s: s if s.startswith("install") else f"install-{s}",
1047-
util.Interpolate("%(kw:title)s", title = target)),
1062+
util.Interpolate("%(kw:title)s%(kw:hint:-)s", title = target, hint = hint_suffix)),
10481063
options = ["--build", ".", "--target", target],
10491064
description = ["Install just built components:", target],
10501065
haltOnFailure = False,

0 commit comments

Comments
 (0)