-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[workspace] [POC] Handle all the packages involved in a WS (editables and dependents) #5314
Conversation
…issue/5291-workspaces
|
||
t.run("workspace install ws.yml") | ||
t.run_command('mkdir build') | ||
t.run_command('cd build && cmake ..' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having seen all these flags, it comes to my mind the idea of creating a conanfile.py
to use build helpers to build/handle the workspace... 🤔
Here we are removing the setUpClass functions in the test class because it produces failures in the CI (not locally). Maybe related to the CI running several processes?
Does this by any chance make it possible in future to have packages in a workspace that aren't actually being built by cmake itself? That would be cool.
I'd prefer to be including some generated cmake file only, not having the main one generated for me.
Do we need to have it in the source directory? Would prefer my source directories to be untouched by generated stuff. Are layouts still necessary in this model? Isn't it the case that packages can put their editable layout in the conanfile? Would be cool if we only needed to specify layouts for those packages that don't have it defined in their recipe. |
Yes, now that we have lockfiles it is fairly easy to create a custom CMake target to run
Probably this is just a detail, Conan may autogenerate a
I don't think this is necessary, it can probably be in any folder. Again, I think this is something to take into account after deciding about the main changes in this PR.
There is a work in progress trying to embed layouts into the recipe (or infer them), so at some point in time layout files could not be needed anymore. Anyway, layouts (inferred or not) are still necessary for this PR:
|
I've installed this branch with pip and been testing with my project. One thing:
Those versions of Catch are build requirements in two different packages in my workspace. Not sure if this is intentional, I think it's probably necessary for packages to have requirements that are isolated from others, I know there's some debate about this. I know you said you mainly want to just figure out if the core concepts of this PR are OK but I think sometimes you don't see conceptual problems without projects working in the wild. So the following are bugs as I've found with my project, I won't be offended if you ignore this but anyway: The There is a weird problem with PkgConfig, Only with you branch this is failing in one of the editables:
With the following:
If you look at the PkgConfig code for this if statement, you can see the the missing part after "LESS" above is EDIT: another bug, default options seem to be ignored in editables- |
Thanks a lot @Lawrencemm for taking the time to test and experiment with this POC. It's always welcome to know about things that fail and take it for granted that they will be addressed if this PR moves on. Right now IMO it is better to leave it just with the core changes of this alternative implementation. Some of the problems you mention are quite relevant, Nevertheless, now it has diverged a lot from |
Hi @jgsogo. Can you give an update on the workspaces development? We're languishing back at version 1.12 because our conan workflow broke with the subsequent redesign of workspaces. I would very much like to update to the latest conan version so I can get new features and fixes! I'd love to get some info on the latest direction to be able to provide feedback. Most important details of my use case have been described in #5762 and related issues. These include:
From what I can see in your description, these don't appear to be things you're planning to support. I'd love to have a discussion on this. Thanks! |
I thought of other important points that may not be on the radar:
In short, we need the super build to manage distinct conan invocations for each root, allowing for individual profiles. This is goes beyond allowing hetergenous toolchains: it allows interdependent conan invocations (hetergeneous settings and platforms)! Yet the super build still needs to track dependencies across the roots so that when one is changed, others will be rebuilt. |
Obsolete, workspace feature removed for 2.0, completely new editables. Lets close it and we will revisit workspaces after 2.0. |
Changelog: (Feature | Fix | Bugfix): Describe here your pull request
Docs: https://github.com/conan-io/docs/pull/XXXX
Related to #5291 (close?) and #4879 (superseedes)
This PR implements a new approach of workspaces: packages declared inside the
conanws.yml
file are consumed using CMake targets (see (1) in the TODO list), and packages that depend on any of these are declared ascustom_targets
(only a sentinel at this moment, see (2) in the TODO list). CMake models all the dependencies between these projects and triggers the build of the projects that are affected by any change.Graph used in the tests:
In this implementation, we can distinguish three categories for packages:
conanws.yml
:pkgA
,pkgB
,pkgE
andpkgG
pkgH
,pkgD
pkgC
andpkgF
Workspace creation
We need the
conanws.yml
file:Comments about the fields:
root
s, all the editables will be included as roots so we get sure they override any existing dependency upstreams. This solves the issue of the version ranges.workspace_generator
: currently onlycmake
, but in the future it should acceptvisual_studio
too.Generated files (CMake)
CMakeLists.txt
I'm generating the
CMakeLists.txt
file:project(...)
if I add aname
field toconanws.yml
fileconanbuildinfo.cmake
to keep doing Conan magic, this file has been generated without dependencies.RPATHS
, so linux binaries will find shared libraries.SKIP_RPATHS
for the same behavior.NO_OUTPUT_DIRS
so each library will generate the binaries in the place defined by thelayout
file (see (3) in TODO list).conanworkspace.cmake
And also, it generates a
conanworkspace.cmake
file, I'm dividing it into sections to talk about each one:These packages are consumed by editable ones, I cannot know if they are being consumed using the
cmake + TARGET
approach or thecmake_find_package
approach, so I'm generating the alias for both.pkgC
andpkgF
must be creating transitive targets too, check how CMake handles this duplication.conanws.yml
to check which generators are being used.Override functions, I have already executed⚠️ I think it is ok if we do not support consuming dependencies using
conan_basic_setup
, no need to do it again (also, I don't want${CONAN_LIBS}
to be populated).${CONAN_LIBS}
I don't want to
find_package
again any library that is being handled by the workspace.Custom targets for package corresponding to the category (3), right now this is just a
custom_target
running a dummycustom_command
(see (2) in the TODO list).Packages inside the workspace (category (1)) are included using
add_subdirectory
. Afterwards, I need to create the aliases corresponding to generatorscmake
andcmake_find_package
because these packages can be consumed using any of those approaches.Packages outside the workspace are added as
custom_target
with the dependencies declared. This is needed to have the full graph representation of the workspace into the CMake model.TODO:
conanws.yml
can contain atarget
field to use. But still, this is limited to only one target per package.Other tasks⚠️
cmake
generator@tags: slow