I have spent several days attempting to develop a SwiftPM plugin that uses MIG to generate source from Mach interface definition files. MIG generates C source files and corresponding headers, for those not familiar with MIG. Hence, this plugin would only work for a target containing C-family source.
After several days of experimenting with different plugins, it seems that SwiftPM plugins treat Swift targets different from C-language family targets. The first observation I made concerns the list of source files exposed to the plugin. Specifically, it seems that the plugin can only see C, C++, and Objective-C files, as opposed to anything else. I tried using the same plugin with a Swift target, and the ".def" file the plugin needs to process does appear in the source file list associated with the target.
This wasn't difficult to work around, as the target provides its path. Thus, it was as simple as enumerating the files in the directory specified by the path and filtering out ".def" files. I was able to pick out ".def" files and generate the necessary ".c" and ".h" files. The build logs clearly showed that the plugin ran successfully, generated the necessary files, and put them in the appropriate directory in the build tree. However, this is where SwiftPM would stop; it did not compile the ".c" file.
I have looked at other build plugins doing similar code generation. However, they all generate Swift source files, and it seems SwiftPM integrates them into the dependency graph it uses to carry out the build just fine.
I want to know if this behavior is intentional? If not, how do I go about filing a bug against SwiftPM?