doozMen
(Stijn Willems)
1
I have a plugin that generates a swift file on build via a plugin. In another target in the same package I would like to use that file as input. However I notice that the sourcefiles on the target do not include generated source files in the pluginWorkingDirectory?
Inside my plugin I have the following:
guard let chameleonTarget = try context.package.targets(named: ["Chameleon"]).first as? SwiftSourceModuleTarget else {
throw Error.chameleonTargetMissing
}
guard let commonTokenNamesSwiftFile = (chameleonTarget.sourceFiles.first { $0.path.lastComponent == "ThemeConfiguration.TokenName-generated.swift"}) else {
throw Error.commonTokenNamesSwiftFileMissing
}
Is what I'm asking for just not possible? Given build dependencies and all.
NeoNacho
(Boris Buegling)
2
I have to double check the implementation, but I believe the context.package model is based on the model after loading packages and generated source files are only visible to the build system. I would consider this more of a bug, though.
doozMen
(Stijn Willems)
3
That corresponds to my observations. I can reproduce it in a small project and will file a bug report then. Thanks
doozMen
(Stijn Willems)
4