conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.26k stars 981 forks source link

[question] Managing internal dependencies with versions handled by CI system #14182

Closed fschoenm closed 2 months ago

fschoenm commented 1 year ago

What is your question?

Hello, I wonder if you have a recommendation for handling the following scenario:

Imagine we have two repos libA and libB. libB depends on libA. Out CI system checks out both repos, usually on the master branch but it can be any tag or branch, configured in the CI system. Then we build both libs together manually.

I now want to create a conan package of libA and consume the package in libB. However, I'm not sure how to correctly use the version of libA. What's the best approach here?

Have you read the CONTRIBUTING guide?

memsharded commented 1 year ago

Hi @fschoenm

I now want to create a conan package of libA and consume the package in libB. However, I'm not sure how to correctly use the version of libA. What's the best approach here?

In principle, if the libB depends on libA the idea is that to build libB you already need to define the package libA and the version you want to use to build libB. Otherwise, there is indeed an indetermination problem, as you are trying to package something (libB) trying to make it depend on something else (libA), but in reality the package libB doesn't depend on the package libA because you didn't need nor use the package libA to build it.

This is the duality of mono-repo development and component/package-based development. If libB and libA are to be independently versioned and released packages, they need to be independently developed and versioned, and consumed accordingly by the consumers when the consumers need to build themselves.

Said that, there might be some possibilities to try to dynamically define some versions that make sense: