Using SPM plugin generated code in both iOS and watchOS target

Hi,

I have a Xcode project with a iOS and watchOS target. I’m using protobuf to encode messages, and I tried to put all the code related to this on a SPM shared between the iOS and watchOS target

Here is my Package.swift files:

import PackageDescription

let package = Package(
    name: "Protobuf",
    products: [
        .library(name: "Protobuf", targets: ["Protobuf"]),
    ],

    dependencies: [
        .package(url: "https://github.com/apple/swift-protobuf", from: "1.0.0"),
    ],

    targets: [
        .target(
            name: "Protobuf",
            dependencies: [.product(name: "SwiftProtobuf", package: "swift-protobuf")],
            plugins: [
                .plugin(name: "SwiftProtobufPlugin", package: "swift-protobuf")
            ])
    ]

)

I've added this package to my Xcode project, and added the Protobuf library to the iOS target, and the project compile fine, but when I also add the Protobuf library to the watchOS target, Xcode give me a compile error telling that multiple commands produce the swift file generated from the .proto file.

Am I doing something wrong or is this a Xcode issue ?

Using SPM plugin generated code in both iOS and watchOS target
 
 
Q