conan-io / conan

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

[feature] Add self.editable_mode #11180

Open dfleury2 opened 2 years ago

dfleury2 commented 2 years ago

Hi, when using Conan with new CMakeToolchain, and with some dependencies on editable mode, the consumer project will launch the generate method for the dependencies into their directories. The "legacy" generator like virtualrunenv will generate their files at the root of the editable project.

Can we have a way to detect the editable mode in def generate method so we can disable it completely ? I am not sure if it used later anyway since when I remove them all is working fine. Regards

memsharded commented 2 years ago

Hi @dfleury2

Adding such attribute seems an antipattern. In theory things should work the same in editable or in the cache. Probably the main issue is that virtualrunenv is a legacy generator, but VirtualRunEnv files, which is the new approach, and the one that supersedes the former, will put the files in the generators folder of the editable package, not polluting the root?

dfleury2 commented 2 years ago

Hi @memsharded , yes the issue is probably due to this legacy status. I have made some experimentations using VirtualRunEnv, so effectively, the files are not generated in the root of the editable project anymore. Great. Unfortunately, I have seen some issues. The file names have been changed to something else, so I will need to tweek my CI/CD to move the others projects without breaking everything. There is still the file graph_info.json that is generated still.

I will probably wait before moving forward.

I still wondering why the generate is called in edtiable mode since the project is probably already compiled and the libs (and tools) already available. Else, I agree that is clearly an antipattern. But I did not find another idea to disable this generate call.