conan-io / conan

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

[question] What is the order of conan methods call? #16410

Closed DmitrySokolov closed 1 month ago

DmitrySokolov commented 1 month ago

What is your question?

What is the call order of https://docs.conan.io/2/reference/conanfile/methods.html ?

In particular, the call order of:

Have you read the CONTRIBUTING guide?

memsharded commented 1 month ago

Hi @DmitrySokolov

Thanks for your question.

You have the order of the conan create in https://docs.conan.io/2/reference/commands/create.html#methods-execution-order

DmitrySokolov commented 1 month ago

Hi @memsharded

Thanks!

But why there are 2 init() calls?

memsharded commented 1 month ago

But why there are 2 init() calls?

The export and the install are separate steps, one loads the recipe in the user space, and then install loads the recipe in the cache, to guarantee reproducibility. The create command is equivalent to conan export + conan install --requires=<thepkg> --build=<thepkg> + conan test ...

DmitrySokolov commented 1 month ago

So, the self.version field acquired in set_version() will be available in layout(), right?

memsharded commented 1 month ago

So, the self.version field acquired in set_version() will be available in layout(), right?

Yes, but set_version() only works at export time, the self.version might come from the cache metadata once the package is in the cache, without executing the set_version() method.

DmitrySokolov commented 1 month ago

Thanks!