16

I am adding Conan support to my CMake projects. I followed Recipe and sources in the same repo tutorial and I end up with the expected package. Exploring the local repository folder, I found out that my source files are copied in 3 different folders (source, build and export_source) so the repo is growing fast even with small projects.

Is there a way to clean repository folders where sources are duplicated, after package creation (keeping only the folder needed for "dependency build from sources")?

Cyclonecode
  • 29,115
  • 11
  • 72
  • 93
Marco Stramezzi
  • 2,143
  • 4
  • 17
  • 37

1 Answers1

21

Sure, you can remove things from the cache with the conan remove command. In this case you probably want to do:

conan remove "*" -s -b -f
  • * to match all packages in your local cache
  • -s to remove the source folders
  • -b to remove the build folders
  • -f to not ask for confirmation

The sources stored together with the conanfile.py in the cache, can't be removed, cause they are stored with the conanfile to be able to rebuild from sources when conan install --build is done.

drodri
  • 5,157
  • 15
  • 21
  • Thanks drodri! Do you know if there is also a way to do that programmatically from conanafile.py? – Marco Stramezzi May 10 '18 at 13:11
  • 3
    No it is not possible, even if recipes have access to ``self.source_folder``, ``self.build_folder``, etc., it would violate all decoupling and concurrency, for example if you are building in parallel several configurations of the same package (e.g. debug/release), and one of them decides to remove the source folder, then it will collide with the other one still building and using that source. Even if not doing concurrent installations, if you need to build different configurations sequentially, they will be much slower. You can use ``no_copy_source`` to avoid 1 source copy if you want. – drodri May 11 '18 at 08:44