This repository has been archived by the owner on Jun 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Experiments with bazel build system #24
Draft
pawelchcki
wants to merge
17
commits into
DataDog:main
Choose a base branch
from
pawelchcki:pawel/bazel-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Heads up - I've run into an issue on my osx laptop (due to recently updated xcode) Works fine in OSX Ci and on lInux. so YMMV |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why try Bazel ?
libddprof build system is already a bit complex- having 4 (cargo, custom dockerfiles with build dependencies, bash, and CI) components necessary to produce the final artifacts. With more supported configurations added it might get even more complex, in order to support all edge cases
Bazel has the potential to simplify some of that, as it can handle most of build dependencies, and has unparalleled control over the shape of the final artifact.
This PR is only an experiment (for now :) ) to see what (if anything) could actually be gained from using it to produce the final artifacts.
Smaller binaries ?
Posting this PR a bit earlier than planned. Actually I was just experimenting with Bazel without expecting to post a PR at all....
But I discovered it can compile the shared library and static library, at significantly smaller binary sizes than cargo!
Though it's possible something is missing from cargo config, or that the binaries are invalid, although that is not very likely.
-Currently the size for release version (bazel build) for the .so file is 6MB and 20MB for .a vs 18MB and 100 MB for cargo.-
Update: it turned out that bazel build didn't generate the debuginfo from the binaries by default. With debuginfo the sizes are almost identical (+30kB on bazel side)
Usage:
Still TODO:
cargo raze
from the repository (possible to generate it manually before each build, or via repository rule)bazel test //ruby/...
works too (nice to have)