Let's assume that part of a codebase needs, for some reason, to be written in some non-Swift language. And let's assume said language has tooling that can generate a C-style libfoo.a
static archive and an associated foo.h
header file. Easy use for a BuildToolPlugin
, right? Just run the tool to generate the library and then link against it like you would any other C library.
Except I can't seem to get it to work. The script runs, the library and header get created in the appropriate location inside .build/plugins/outputs/foo/libfoo/BuildPlugIn/
, but I cannot manage to get the package to actually link against them. The Swift Package Manager wants these to actually be inside the source directory, which of course can't be done with a build tool plugin. Additionally, the build tool plugin itself complains about the existence of these files that it doesn't know what to do with:
error: unexpected input file: /path/to/.build/plugins/outputs/foo/libfoo/BuildPlugIn/build/include/libfoo.h`
error: unexpected input file: /path/to/.build/plugins/outputs/foo/libfoo/BuildPlugIn/build/lib/libfoo.a`
error: unexpected input file: /path/to/.build/plugins/outputs/foo/libfoo/BuildPlugIn/build/include/module.modulemap` (for the times that I've tried that)
Is this just not possible, or am I doing something wrong here?