For WWDC22 session "Meet Swift Package plugins " the following code snipped is shared in Apple's Developer application:
In Xcode 14 Beta 1 I receive the compilation error Cannot find type 'XcodeBuildToolPlugin' in scope
Is the given example valid and is a struct/type missing in the new library module XcodeProjectPlugin
? Or needs the example code to be adjusted (further then I bug I mentioned below in the comments)?
import PackagePlugin
@main
struct MyPlugin: BuildToolPlugin {?
/// This entry point is called when operating on a Swift package.
func createBuildCommands(context: PluginContext, target: Target) throws -> [Command]
debugPrint(context)
// BUG: needs to return an array !!!!!!!!!!!!!!!!!!!!!!
}
}
#if canImport(XcodeProjectPlugin)
import XcodeProjectPlugin
extension MyPlugin: XcodeBuildToolPlugin {
/// This entry point is called when operating on an Xcode project.
func createBuildCommands(context: XcodePluginContext, target: XcodeTarget) throws -> [Command]
debugPrint(context)
return []
}
}
#endif
The absence of this protocol in Beta 1 is a known issue that is mentioned under the Known Issues at https://developer.apple.com/documentation/Xcode-Release-Notes/xcode-14-release-notes.