Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-86052

Create SCons-Bazel ThinTarget Support

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Build
    • Fully Compatible

      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.

            Assignee:
            daniel.moody@mongodb.com Daniel Moody
            Reporter:
            zack.winter@mongodb.com Zack Winter
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: