From 6956bf4317ea0743a576a59f7137775d40614a22 Mon Sep 17 00:00:00 2001 From: Vladimir Vereschaka Date: Fri, 12 Jul 2024 11:07:15 -0700 Subject: [PATCH] Add new 'hint' argument for UnifiedTreeBuilder.getCmakeExBuildFactory() factory. 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. --- zorg/buildbot/builders/UnifiedTreeBuilder.py | 33 ++++++++++++++------ 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/zorg/buildbot/builders/UnifiedTreeBuilder.py b/zorg/buildbot/builders/UnifiedTreeBuilder.py index ce6a162c1..22b639394 100644 --- a/zorg/buildbot/builders/UnifiedTreeBuilder.py +++ b/zorg/buildbot/builders/UnifiedTreeBuilder.py @@ -620,6 +620,7 @@ def getCmakeExBuildFactory( post_finalize_steps = None, jobs = None, # Restrict a degree of parallelism. env = None, # Common environmental variables. + hint = None, ): """ Create and configure a builder factory to build a LLVM project from the unified source tree. @@ -789,6 +790,15 @@ def getCmakeExBuildFactory( env : dict, optional Common environmental variables for all build steps (default is None). + hint : string, optional + Use this hint 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. + + As example, passing of 'stageX' with 'hint' will force generating of the following step names: + cmake-cofigure => cmake-configure-stageX + build => build-stageX + install => install-stageX + & etc. Returns ------- @@ -866,6 +876,7 @@ def norm_target_list_arg(lst): f = LLVMBuildFactory( depends_on_projects = depends_on_projects, enable_runtimes = enable_runtimes, + hint = hint, llvm_srcdir = llvm_srcdir, src_to_build_dir = src_to_build_dir, obj_dir = obj_dir, @@ -875,7 +886,7 @@ def norm_target_list_arg(lst): f.addSteps([ # Set up some properties, which could be used to configure the builders. steps.SetProperties( - name = 'set-props', + name = f.makeStepName('set-props'), properties = { "depends_on_projects" : ";".join(sorted(f.depends_on_projects)), "enable_projects" : ";".join(sorted(f.enable_projects)), @@ -889,7 +900,7 @@ def norm_target_list_arg(lst): # This is an incremental build, unless otherwise has been requested. # Remove obj dirs for a clean build. steps.RemoveDirectory( - name = 'clean-obj-dir', + name = f.makeStepName('clean-obj-dir'), dir = util.Interpolate(f.obj_dir), description = ["Remove", util.Interpolate(f.obj_dir), "directory"], haltOnFailure = False, @@ -926,7 +937,7 @@ def norm_target_list_arg(lst): if vs: f.addStep( steps.SetPropertyFromCommand( - name = "set-props.vs_env", + name = f.makeStepName("set-props.vs_env"), command = builders_util.getVisualStudioEnvironment(vs, vs_arch), extract_fn = builders_util.extractVSEnvironment, env = env @@ -952,7 +963,7 @@ def norm_target_list_arg(lst): # Remove install directory. f.addSteps([ steps.RemoveDirectory( - name = f"clean-install-dir", + name = f.makeStepName("clean-install-dir"), dir = util.Interpolate(f.install_dir), description = ["Remove", util.Interpolate(f.install_dir), "directory"], haltOnFailure = False, @@ -972,7 +983,7 @@ def norm_target_list_arg(lst): f.addStep( steps.CMake( - name = f"cmake-configure", + name = f.makeStepName("cmake-configure"), path = LLVMBuildFactory.pathRelativeTo(f.llvm_srcdir, f.obj_dir), generator = generator, definitions = cmake_definitions, @@ -983,6 +994,7 @@ def norm_target_list_arg(lst): workdir = f.obj_dir )) + hint_suffix = f"-{hint}" if hint else None # Build Commands. #NOTE: please note that the default target (.) cannot be specified by the IRenderable object. for target in targets: @@ -996,7 +1008,8 @@ def norm_target_list_arg(lst): f.addStep( steps.CMake( - name = util.Interpolate("build-%(kw:title)s", title = target_title), + name = util.Interpolate("build-%(kw:title)s%(kw:hint:-)s", + title = target_title, hint = hint_suffix), options = cmake_build_options, description = ["Build target", target_title], haltOnFailure = True, @@ -1012,7 +1025,8 @@ def norm_target_list_arg(lst): for target in checks: f.addStep( LitTestCommand( - name = util.Interpolate("test-%(kw:title)s", title = target), + name = util.Interpolate("test-%(kw:title)s%(kw:hint:-)s", + title = target, hint = hint_suffix), command = [steps.CMake.DEFAULT_CMAKE, "--build", ".", "--target", target], description = ["Test just built components:", target], descriptionDone = ["Test just built components:", target, "completed"], @@ -1025,7 +1039,8 @@ def norm_target_list_arg(lst): for target, cmd in checks_on_target: f.addStep( LitTestCommand( - name = util.Interpolate("test-%(kw:title)s", title = target), + name = util.Interpolate("test-%(kw:title)s%(kw:hint:-)s", + title = target, hint = hint_suffix), command = cmd, description = ["Test just built components:", target], descriptionDone = ["Test just built components:", target, "completed"], @@ -1044,7 +1059,7 @@ def norm_target_list_arg(lst): f.addStep( steps.CMake( name = util.Transform(lambda s: s if s.startswith("install") else f"install-{s}", - util.Interpolate("%(kw:title)s", title = target)), + util.Interpolate("%(kw:title)s%(kw:hint:-)s", title = target, hint = hint_suffix)), options = ["--build", ".", "--target", target], description = ["Install just built components:", target], haltOnFailure = False,