-
Notifications
You must be signed in to change notification settings - Fork 370
vendor=True feature #3756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
vendor=True feature #3756
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
00e87cf
vendor=True feature
memsharded 934c255
Update devops/vendoring.rst
czoido 8124b8f
Update devops/vendoring.rst
czoido eb06477
Update devops/vendoring.rst
czoido 3880b06
Update devops/vendoring.rst
czoido 0012385
Update devops/vendoring.rst
memsharded 0da383c
Update devops/vendoring.rst
memsharded 9515f9e
Update devops/vendoring.rst
memsharded File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
.. _devops_vendoring: | ||
|
||
Vendoring dependencies in Conan packages | ||
======================================== | ||
|
||
.. include:: ../common/experimental_warning.inc | ||
|
||
From Conan 2.4 it is possible to create and use Conan packages that completely vendor their dependencies, | ||
that is, they completely hide and isolate their dependencies from their consumers. This can be useful | ||
in some different cases: | ||
|
||
- When sharing Conan packages with other organizations, that vendor (copy, embed or link) the dependencies, | ||
so it is not necessary for hte consumers of those packages to have access to those dependencies and the | ||
czoido marked this conversation as resolved.
Show resolved
Hide resolved
|
||
intention is that they always use the shared precompiled binaries. | ||
- To introduce a hard decoupling between parts of a project. | ||
|
||
To make a package vendor its dependencies, define in its recipe the following attribute: | ||
|
||
.. code-block:: bash | ||
|
||
|
||
class MyPkg(ConanFile): | ||
name = "mypkg" | ||
version = "0.1" | ||
|
||
vendor = True | ||
|
||
requires = "somedep/1.2" | ||
|
||
|
||
When we have this recipe, we can create its binaries with a normal ``conan create .``. | ||
But when we use this package as a requirement for other packages, its dependencies will be fully invisible. | ||
The graph will not even expand the ``somedep/1.3`` requirement. This dependency doesn't even need to available | ||
czoido marked this conversation as resolved.
Show resolved
Hide resolved
|
||
in the remotes for the consumers, it will not be checked. | ||
|
||
Some important notes: | ||
|
||
- A package that vendors its dependencies is intended to be consumed always in binary form. | ||
- The dependencies of a vendoring package is always a fully private and isolated dependency graph, decoupled from | ||
memsharded marked this conversation as resolved.
Show resolved
Hide resolved
|
||
the rest of the dependency graph that uses this package. | ||
- It is the responsibility of the vendoring package and its users to guarantee that vendored dependencies do not | ||
collide. If a vendoring package vendors for example ``libssl.a`` as a static library doing a regular copy of | ||
it in its package, and there is another package in the graph that also provides ``libssl``, there will be a | ||
conflict that Conan cannot detect as ``libssl.a`` is vendored as an internal implementation detail of the package, | ||
but not explicitly modeled. Mechanisms like ``provides`` can be used for this purpose, but it is the responsibility | ||
of the recipe authors to take it into account. | ||
- The ``package_id`` of a package that defines ``vendor=True`` is fully independent of its dependencies. The | ||
dependencies versions will never affect the ``package_id`` of the vendoring package, so it is important | ||
to note that the version of the vendoring package represents a full private dependency graph. | ||
- The regular ``default_options`` or options values definitions from consumer ``conanfile.py`` recipes do not | ||
propagate over vendoring packages, as they don't even expand their dependencies. | ||
- If a vendoring package binary is missing and/or the user request to build such a package from sources, Conan | ||
will fail, raising an error that it is not possible to build it. | ||
- To allow the expansion of the private dpenedency the ``tools.graph:vendor=build`` configuration can be activated. | ||
czoido marked this conversation as resolved.
Show resolved
Hide resolved
|
||
If that is the case, the private dependency graph of the package will be computed and expanded and the package | ||
will be allowed to build. |
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.
Uh oh!
There was an error while loading. Please reload this page.