liamnichols / xcstrings-tool

A plugin to generate Swift constants for your Strings Catalogs.

Home Page:https://swiftpackageindex.com/liamnichols/xcstrings-tool/documentation/documentation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Permission error in Xcode Cloud

hiragram opened this issue · comments

Hi,

Thank you for creating xcstrings-tool.
It works fine on my macbook but not on Xcode Cloud.

スクリーンショット 2024-01-03 17 47 38

( Compose is the name of my Swift package)

I am very new to build tools plugin mechanism. Do you have any ideas?

Hmm this is very strange. Unfortunately I have never used Xcode Cloud before so I am not completely sure what might cause this.

I assume that you are experiencing this issue after working around the plugin validation issues described on the Swift forums?

At a guess, it might be related to how I create the output directory (XCStringsTool) for writing the generated source (Compose.swift):

try fileManager.createDirectory(at: directoryURL, withIntermediateDirectories: true)

But I don’t know much about file/directory permissions to know if I need to give the XCStringsTool directory more permissions or not?

I assume that you are experiencing this issue after working around the plugin validation issues described on the Swift forums?

Yes. IDESkipPackagePluginFingerprintValidatation is enabled.

I am looking into stackoverflow which you've pointed out. Thanks.

I have just found execution on local macbook emits warning about location of written files even if it succeeds. Output path may be incorrect. I am looking into it.

image

EDIT: This warning may be caused by my fork changes
EDIT: This warning is caused by my fork changes

@liamnichols What is the purpose of this subdirectory? Is it required to work?

var outputDirectory: Path {
pluginWorkDirectory.appending(subpath: "XCStringsTool")
}

btw, I guess this issue is caused by XcodeCloud-side bug so far. Sent feedback to apple.

I create the subdirectory based on the documentation in the SE proposal:

    /// The path of a writable directory into which the plugin or the build
    /// commands it constructs can write anything it wants. This could include
    /// any generated source files that should be processed further, and it
    /// could include any caches used by the build tool or the plugin itself.
    /// The plugin is in complete control of what is written under this di-
    /// rectory, and the contents are preserved between builds.
    ///
    /// A plugin would usually create a separate subdirectory of this directory
    /// for each command it creates, and the command would be configured to
    /// write its outputs to that directory. The plugin may also create other
    /// directories for cache files and other file system content that either
    /// it or the command will need.
    var pluginWorkDirectory: Path { get }

Please also share the feedback number so that I can duplicate it 🙏

I found another post describing the same issue here (but no solution 🥲): https://developer.apple.com/forums/thread/725474

Finally I've just found what causes this issue. #36