Can Swift plugin target sourceFiles contain generated files?

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.

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.

That corresponds to my observations. I can reproduce it in a small project and will file a bug report then. Thanks

I created a bug report Swift plugin target sourceFiles do not include generated files · Issue #6221 · apple/swift-package-manager with link to github repo to reproduce the issue