[SERVER-63318] make AIB build only targets Created: 04/Feb/22  Updated: 27/Oct/23  Resolved: 27/Oct/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.0 Desired

Type: New Feature Priority: Major - P3
Reporter: Daniel Moody Assignee: [DO NOT ASSIGN] Backlog - Server Development Platform Team (SDP) (Inactive)
Resolution: Won't Do Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Server Development Platform
Participants:

 Description   

Sometimes a developer may just only want to build a component and is not interested in the installation step. AIB should support building all the components dependencies and not needing to wait through the install step for a complete build.

 

Below is a possible solution:

diff --git a/site_scons/site_tools/auto_install_binaries.py b/site_scons/site_tools/auto_install_binaries.py
index 38427d8ef41..b5a955ec03d 100644
--- a/site_scons/site_tools/auto_install_binaries.py
+++ b/site_scons/site_tools/auto_install_binaries.py
@@ -360,6 +360,19 @@ def auto_install_task(env, component, role):
     entry = get_alias_map_entry(env, component, role)
     return list(entry.files)
 
+def build_component_task(env, component, role):
+    """Auto install task."""
+    entry = get_alias_map_entry(env, component, role)
+    build_targets = []
+    for file in list(entry.files):
+        files =  [
+            child
+            for child in file.all_children()
+            if not child.path.startswith(env.Dir("$DESTDIR").path)
+        ]
+        build_targets += files
+
+    return build_targets
 
 def auto_install_pseudobuilder(env, target, source, **kwargs):
     """Auto install pseudo-builder."""
@@ -586,6 +599,7 @@ def generate(env):  # pylint: disable=too-many-statements
     env.AppendUnique(
         AIB_TASKS={
             "install": auto_install_task,
+            "build": (build_component_task, False)
         }
     )
 
diff --git a/site_scons/site_tools/ninja.py b/site_scons/site_tools/ninja.py
index 5826be827f4..8b0d928a04a 100644
--- a/site_scons/site_tools/ninja.py
+++ b/site_scons/site_tools/ninja.py
@@ -671,7 +671,7 @@ class NinjaState:
             # returns True if it finds a header in any of the outputs,
             # here we need to filter so we only have the headers and
             # not the other outputs.
-            if self.is_generated_source(output)
+            if self.is_generated_source(output) and not build["rule"] == "INSTALL"
         })
 
         if generated_source_files:



 Comments   
Comment by Andrew Morrow (Inactive) [ 25/Feb/22 ]

This was actually something we also wanted during the original hygienic builds implementation, but my recollection is that we ran into an implementation challenge so we dropped it. I'd support re-introducing it, but only if we can find a way to make it work consistently.

Comment by Mathias Stearn [ 07/Feb/22 ]

That patch doesn't seem to cover aliases like build-all or build-core.

Generated at Thu Feb 08 05:57:28 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.