[SERVER-86052] Create SCons-Bazel ThinTarget Support Created: 01/Feb/24  Updated: 01/Feb/24

Status: Needs Scheduling
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Zack Winter Assignee: Daniel Moody
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Build
Participants:

 Description   

As part of the bazel migration, we want to remove converted scons nodes as soon as possible. Unfortunately as long as SCons is building the top level libraries, it needs to be aware of all transitive dependencies to use in its link args (-l directive) even after they've been converted to bazel.

To achieve this, the plan is to create "thin targets" that encapsulate the dependency chain of all bazel targets underneath, without including the source file information usually included in a scons target.

Ex for the dependency chain a -> b -> c, where "a" is a program and "b" and "c" have been converted to bazel:

SConstruct:

 
env.Program(
  name="a"
  LIBDEPS=["b", ...]
)
 
env.ThinTarget(
   name="b"
)

BUILD.bzl:

 
cc_library(name="b", deps=["c"], src=["b.cpp"])
cc_library(name="c", src=["c.cpp"])

This allows us to avoid the double-implementation issue since the top level target is just a shallow reference (it's just a name).

The implementation we've discussed is to have SCons invoke "bazel query" on the thin target to pull out the dependency tree underneath and then copy over the resulting artifacts as usual.


Generated at Thu Feb 08 06:59:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.