conan-io / conan

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

[feature] Compose applied configuration in one profile #11155

Open lasote opened 2 years ago

lasote commented 2 years ago

From this thread: https://github.com/conan-io/tribe/pull/34#discussion_r862742661

The idea is to provide a way to "freeze" the applied profiles (host + build) by combining all the inputs provided, so with just one file you could reproduce a build. Some ideas:

With a different command: conan profile compose --profile:h=foo -s:h arch=x86 -c myconf=1 --profile_out:h=profile_host_windows_x86.txt

Directly with arguments: conan lock create . --profile:h=foo -s:h arch=x86 -c myconf=1 --profile_out:h=profile_host_windows_x86.txt

ytimenkov commented 2 years ago

Yes, an extra file produced on a side would help with the use-case in the tribe comment.

Having profile_out in same commands as lockfile-out is less typing and maybe somewhat convenient (at least conan create / conan install --build).

But otherwise a separate command is also fine. Then the workflow to create a package on CI would be profile create -> lockfile create -> create, each taking output from the previous "stage".

maikelvdh commented 2 years ago

I do think the similar feedback as pointed out for lockfile should be taken into account here. Summarised:

KerstinKeller commented 2 years ago

If all conan commands would automatically produce an output profile (and consume it, too) in the cwd, it would effectively function like a cache. It would promote "out of source builds" (e.g. don't conan install in your source folder, one build / install folder per profile) which is good practice anyways.

And the best thing about it, that it would allow to create generators with a CMake like "Zero Check" functionality (e.g. to rerun Conan in case that conanfile.py was changed). With the current functionality it is impossible to create such a generator, because there is no way to capture the original arguments to the conan invocation.

ytimenkov commented 2 years ago

And the best thing about it, that it would allow to create generators with a CMake like "Zero Check" functionality

Good use-case I didn't think about. I think conaninfo.txt was pretty close to it.

I would just replace "cwd" with "install folder". It usually defaults to cwd so there shouldb't be much difference if you omit it, but will be less confusing when it's specified.

memsharded commented 2 years ago

It would promote "out of source builds" (e.g. don't conan install in your source folder, one build / install folder per profile) which is good practice anyways.

Fortunately, with layout() now most builds are automatically "out-of-source" (at least they are moved to a build folder, not polluting the project root).

Good use-case I didn't think about. I think conaninfo.txt was pretty close to it.

conaninfo.txt will not longer be locally generated in 2.0.