To help us debug your issue please explain:
A team within my organization currently builds and publishes an SDK of C++ headers and libs using an executable MSI intaller. We would like to switch over to having them publish their packages internally via Conan. However they will still need to release their packages via an installer to support some clients who may not be adopting a Conan-based workflow.
To reduce duplication and error, ideally the workflow would be: 1) build libs using Conan with CMake -> 2) publish package using Conan -> 3) generate additional installer from Conan package.
Does Conan have any facilities that could help do this? Worst case, is there a 'bare' package export command that could be used to download and unzip all contents of a package to an arbitrary directory?
Related:
https://github.com/conan-io/conan/issues/2545 "Create a standalone installer for Conan that bundles the Python dependency"
I think the currently possible approaches would be:
In the package recipe, add a deploy() method. This method will just do a self.copy of all files. If the package has dependencies, you might want to use the self.copy_deps() to also define which files from the possible dependencies you want. With that method you can run conan install MyPkg/version@user/channel and it will copy the files you want to your user folder (can be specified by --install-folder)
If you don't want to modify the package recipe, you could also write a simple conanfile.txt with the [requires] of the package, and an [imports] section, specifying basically all files. Then run a conan install . over that conanfile.txt, and you get the files (and also files from dependencies if necessary)
I think these approaches are more powerful and complete, as they can manage to retrieve dependencies files automatically to your user folder, which otherwise would be manual and tedious.
Thanks for the suggestions!
Googling about the Conan deploy() method, I also came across the potentially relevant:
https://github.com/conan-io/conan/issues/3280 "Feature Request : "conan deploy" command"
where I see someone working through the same use case:
What we need is to extract files out of Conan packages into user-space for use in software-pipeline which are do not involve Conan. This includes creating MSI/RPM/DEB packages containing DLL and executable files and licenses from open-source packages, as well as from our own libraries.
Adding link to the reference, for other readers: https://docs.conan.io/en/latest/reference/conanfile/methods.html#deploy
Yes, in #3280 there is some ongoing discussion for something that would be related, would try to implement the feature but without having to implement a deploy() in the recipes.
For the case of having to do it just for one package, then writing a deploy() method is probably still the recommended approach, as it is very explicit and easier to customize.
So experimenting with this a little, if I add the deploy() method, then the local dump of all package contents will happen each time I perform a conan install of this package, right?
Doesn't that mean Conan-aware users who try to install this package will always also implicitly invoke deploy() and end up with a straight directory structure dump of the package contents? That seems undesirable.
Perhaps separating out that is part of the motivation behind #3280?
So experimenting with this a little, if I add the deploy() method, then the local dump of all package contents will happen each time I perform a conan install of this package, right?
The deploy() method is only fired when you explicitly call it via conan install Pkg/version@user/channel. If you are using that package as a declared requires from other conanfiles, transitive requirement, package creation, or the rest of conan commands, the deploy() won't be fired.
It's been a long time since this issue was opened... now Conan provides a deploy generator (https://docs.conan.io/en/latest/reference/generators/deploy.html) that can be used to achieve this behavior:
conan install <reference> -g deploy --install-folder <target-dir>
Once all the files from packages are in the user directory, a local script can work on them to create the installer.
I'm closing this issue, but feel free to open it again if the provided feature is not enough for the purpose, maybe I'm missing something