I've been looking into SwiftPM build plugins in the last month or so. Sometimes when building a clean project that includes source code generated from a build plugin I get a load of undefined symbols link errors from code using the generated code. eg The project GitHub - adam-fowler/soto-codegenerator-plugin-test produces the following errors
Undefined symbols for architecture arm64:
"_$s7SotoSNS0B0V0A4Core10AWSServiceAAMc", referenced from:
_$s7SotoSNS0B0VAC0A4Core10AWSServiceAAWl in SNSTest.swift.o
"_$s7SotoSNS0B0V11createTopic_6logger2onAC06CreateD8ResponseVAC0gD5InputV_7Logging6LoggerV7NIOCore9EventLoop_pSgtYaKF", referenced from:
_$s7SNSTest3RunV4mainyyYaKFZTY0_ in SNSTest.swift.o
(maybe you meant: _$s7SotoSNS0B0V11createTopic_6logger2onAC06CreateD8ResponseVAC0gD5InputV_7Logging6LoggerV7NIOCore9EventLoop_pSgtYaKFfA0_)
"_$s7SotoSNS0B0V11createTopic_6logger2onAC06CreateD8ResponseVAC0gD5InputV_7Logging6LoggerV7NIOCore9EventLoop_pSgtYaKFTu", referenced from:
_$s7SNSTest3RunV4mainyyYaKFZTY0_ in SNSTest.swift.o
"_$s7SotoSNS0B0V11deleteTopic_6logger2onyAC06DeleteD5InputV_7Logging6LoggerV7NIOCore9EventLoop_pSgtYaKF", referenced from:
_$s7SNSTest3RunV4mainyyYaKFZTY2_ in SNSTest.swift.o
(maybe you meant: _$s7SotoSNS0B0V11deleteTopic_6logger2onyAC06DeleteD5InputV_7Logging6LoggerV7NIOCore9EventLoop_pSgtYaKFfA0_)
"_$s7SotoSNS0B0V11deleteTopic_6logger2onyAC06DeleteD5InputV_7Logging6LoggerV7NIOCore9EventLoop_pSgtYaKFTu", referenced from:
_$s7SNSTest3RunV4mainyyYaKFZTY2_ in SNSTest.swift.o
"_$s7SotoSNS0B0V16CreateTopicInputV10attributes20dataProtectionPolicy4name4tagsAESDyS2SGSg_SSSgSSSayAC3TagVGSgtcfC", referenced from:
_$s7SNSTest3RunV4mainyyYaKFZTY0_ in SNSTest.swift.o
"_$s7SotoSNS0B0V16DeleteTopicInputV8topicArnAESS_tcfC", referenced from:
_$s7SNSTest3RunV4mainyyYaKFZTY2_ in SNSTest.swift.o
"_$s7SotoSNS0B0V6client6region9partition8endpoint7timeout19byteBufferAllocator7optionsAC0A4Core9AWSClientC_AK6RegionVSgAK12AWSPartitionVSSSg7NIOCore10TimeAmountVSgAT04ByteiJ0VAK16AWSServiceConfigC7OptionsVtcfC", referenced from:
_$s7SNSTest3RunV4mainyyYaKFZTY0_ in SNSTest.swift.o
"_$s7SotoSNS0B0VN", referenced from:
_$s7SNSTest3RunV4mainyyYaKFZTY0_ in SNSTest.swift.o
_$s7SotoSNS0B0VAC0A4Core10AWSServiceAAWl in SNSTest.swift.o
ld: symbol(s) not found for architecture arm64
I only found this issue while the project is loaded into VS Code (Xcode works fine). It appears to be because sourcekit-lsp is running on the same folder. I can kill the sourcekit-lsp process and it will start compiling fine. Is there anything that sourcekit-lsp might be doing that could break the build?