Skip to content

Plugin fails in Xcode Cloud: "You don’t have permission to save the file “Strings.swift” in the folder “SwiftGenPlugin” #18

@gereons

Description

@gereons

Running the Swiftgen plugin in an Xcode Cloud build fails with the following errors:

Plug-in ended with non-zero exit code: 64)
xcodebuild: error: Failed to copy build products to test products file with error: The file “Products” couldn’t be opened because there is no such file.
It seems like there was an error running SwiftGen.
Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “Strings.swift” in the folder “SwiftGenPlugin”." UserInfo={NSURL=file:///Volumes/workspace/DerivedData/SourcePackages/plugins/assets.output/Assets/SwiftGenPlugin/Strings.swift, NSUserStringVariant=Folder, NSUnderlyingError=0x6000036c5ce0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}

The Package.swift for our "Assets" Package looks like this:

// swift-tools-version: 5.9

import PackageDescription

let package = Package(
    name: "Assets",
    defaultLocalization: "de",
    platforms: [.iOS(.v17)],
    products: [
        .library(name: "Assets", targets: ["Assets"]),
    ],
    dependencies: [
        .package(url: "https://github.com/chrs1885/WCAG-Colors.git", from: "1.0.0"),
        .package(url: "https://github.com/SwiftGen/SwiftGenPlugin", from: "6.6.0")
    ],
    targets: [
        .target(
            name: "Assets",
            dependencies: ["WCAG-Colors"],
            path: "Sources",
            resources: [.copy("Resources/dummy.txt")],
            plugins: [
                .plugin(name: "SwiftGenPlugin", package: "SwiftGenPlugin")
            ]
        ),
    ]
)

and swiftgen.yml is

xcassets:
  inputs: Sources/Resources/Assets.xcassets
  outputs:
    templateName: swift5
    output: ${DERIVED_SOURCES_DIR}/Assets.swift
    params:
      publicAccess: true

strings:
  inputs: Sources/Resources/de.lproj/Localizable.strings
  outputs:
    templateName: structured-swift5
    output: ${DERIVED_SOURCES_DIR}/Strings.swift
    params:
      publicAccess: true

(Possibly related to #12 and/or #13?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions