I've got a decent size project with 10 or so dependencies. I've just switched to Xcode 11 and moved all the modules I can from using Carthage to the new SPM support in Xcode.
One of my dependencies is https://github.com/iwasrobbed/Down.git a common markdown parser. It includes libcmark, a C library. After cleaning my build folder, the only module map is
./SourcePackages/checkouts/Down/Source/cmark/include/module.modulemap
The first build works, but now find returns
./SourcePackages/checkouts/Down/Source/cmark/include/module.modulemap
./Build/Intermediates.noindex/Down.build/Debug/libcmark.build/libcmark.modulemap
After making a change to the source code and recompiling, the same two modulemaps are there, but I get the error
/Users/mlilback/Library/Developer/Xcode/DerivedData/Rc2Client-bqmhvrpuhrtqjdfbdeqbqzhmotdc/Build/Intermediates.noindex/GeneratedModuleMaps/macosx/libcmark.modulemap:1:8: error: redefinition of module 'libcmark'
module libcmark {
^
/Users/mlilback/Library/Developer/Xcode/DerivedData/Rc2Client-bqmhvrpuhrtqjdfbdeqbqzhmotdc/SourcePackages/checkouts/Down/Source/cmark/include/module.modulemap:1:8: note: previously defined here
module libcmark [system][extern_c] {
^
This makes no sense to me. Why does it compile the first time? What can I do to avoid constantly having to clean the build folder and wait for a fresh build?