[SERVER-81923] Adjust Bazel to not automatically builds all bazel targets regardless of what targets are requested to be built Created: 06/Oct/23  Updated: 13/Nov/23  Resolved: 02/Nov/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.2.0-rc0

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

Issue Links:
Depends
is depended on by SERVER-82263 add generated build metrics tasks whi... Open
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

Currently the bazel integration triggers bazel to build all targets even if only a single scons target is requested to be built:

rm build/fast -r; python3 ./buildscripts/scons.py BAZEL_BUILD_ENABLED=1 --build-profile=fast --ninja=disabled --link-model=dynamic -j 200  --modules= build/fast/mongo/db/commands/libfsync_locked.a
 
...
 
INFO: Analyzed 2 targets (0 packages loaded, 0 targets configured).
INFO: Found 2 targets...
INFO: Elapsed time: 0.362s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
scons: *** [build/fast/mongo/db/commands/libfsync_locked.a] /home/ubuntu/mongo/build/fast/mongo/platform/libvisibility_test_libcommon.so: No such file or directory

This is because the `bazel_library` function is invoked for every defined BazelLibrary entry in SConscript and is completely detached from the scons targets requested to be build in the CLI.



 Comments   
Comment by Githook User [ 02/Nov/23 ]

Author:

{'name': 'Daniel Moody', 'email': 'dmoody256@gmail.com', 'username': 'dmoody256'}

Message: SERVER-81923 Only build bazel targets associated with scons targets
Branch: master
https://github.com/mongodb/mongo/commit/67859ce9db7315eb9fb415974c6f0790012bf9d8

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