Does somebody know how to vendor a 3rd-party libra...
# general
r
Does somebody know how to vendor a 3rd-party library into a mono-repo using pants? e.g.,
git subtree add --prefix vendor/mylib <repo> main --squashed
I'm a little confused about how to let my codes in
src
to refer them as dependencies directly, because until building & packaging those copied source directories, they are not directly importable. Depending on `mylib`'s directory structure, it may or may not be possible to do so.
• Solution 1: Precompile them, put into a wheelhouse directory (probably using Git LFS), and use the local requirements • Solution 2: Use
git subtree split
to only include the actual source directory of the target library. (Problem: I'd like to keep the entire target repo structure to ensure existence of LICENSE. Also I need to replicate their build scripts in
BUILD
files)
I'd like to keep the original repository content intact.
b
How have you configured the source roots? (https://www.pantsbuild.org/docs/source-roots#configuring-source-roots-using-patterns) I haven't done this myself, but I could imagine using
root_patterns = [..., "/vendor/mylib/any/dir/here"]
allow
import mylib
to pick up
vendor/mylib/any/dir/here/mylib
?
r
Another issue is... how could I distribute those vendored libraries together?;