I've encountered a similar issue building an app with a package, MyPackage
, that has a single MyPackage
target using a FooPlugin
build tool plugin from the Foo
package. Everything works as expected when building locally, but I encounter an error on Xcode Cloud due to insufficient permissions:
=== BUILD TARGET MyPackage OF PROJECT MyPackage WITH CONFIGURATION Debug ===
...
WriteAuxiliaryFile /Volumes/workspace/DerivedData/Build/Intermediates.noindex/MyPackage.build/Debug-iphonesimulator/MyPackage.build/Script-8495445145755076753.sh (in target 'MyPackage' from project 'MyPackage')
cd /Volumes/workspace/repository/Packages/MyPackage
write-file /Volumes/workspace/DerivedData/Build/Intermediates.noindex/MyPackage.build/Debug-iphonesimulator/MyPackage.build/Script-8495445145755076753.sh
PhaseScriptExecution Foo /Volumes/workspace/DerivedData/Build/Intermediates.noindex/MyPackage.build/Debug-iphonesimulator/MyPackage.build/Script-8495445145755076753.sh (in target 'MyPackage' from project 'MyPackage')
cd /Volumes/workspace/repository/Packages/MyPackage
/bin/sh -c /Volumes/workspace/DerivedData/Build/Intermediates.noindex/MyPackage.build/Debug-iphonesimulator/MyPackage.build/Script-8495445145755076753.sh
Error: You don’t have permissio
n to save the file “Foo.swift” in the folder “FooPlugin”
.
Command PhaseScriptExecution failed with a nonzero exit code
Result bundle written to path:
/Volumes/workspace/resultbundle.xcresult
** TEST BUILD FAILED **
For reference, the output from the earlier Process build tool plug-in results
is:
Apply build tool plug-in “FooPlugin” to target “MyPackage” in package “mypackage”
Process build tool plug-in results
package: <IDESwiftPackageCore.IDESwiftPackage:0x7f9c1c2069e0 path:'/Volumes/workspace/repository/Packages/mypackage'>
target: MyPackage
prebuildOutputPaths: []
buildCommands: [SwiftPM.SPMCustomBuildCommand(displayName: Optional("Foo"), executable: "/${BUILD_DIR}/${CONFIGURATION}/Foo", arguments: ["--input", "/Volumes/workspace/repository/Packages/MyPackage/Sources/MyPackage/Resources/en.lproj/Localizable.strings", "--output", "/Volumes/workspace/DerivedData/SourcePackages/plugins/mypackage.output/MyPackage/FooPlugin/Foo.swift"], environment: [:], workingDir: nil, inputPaths: ["/Volumes/workspace/repository/Packages/MyPackage/Sources/MyPackage/Resources/en.lproj/Localizable.strings"], outputPaths: ["/Volumes/workspace/DerivedData/SourcePackages/plugins/mypackage.output/MyPackage/FooPlugin/Foo.swift"], sandboxProfile: Optional(SwiftPM.SPMSandboxProfile(strictness: Basics.Sandbox.Strictness.writableTemporaryDirectory, writableDirectories: [<AbsolutePath:"/Volumes/workspace/DerivedData/SourcePackages/plugins/mypackage.output/MyPackage/FooPlugin">], readOnlyDirectories: [<AbsolutePath:"/Volumes/workspace/repository/Packages/MyPackage">])))]
allDerivedOutputPaths: ["/Volumes/workspace/DerivedData/SourcePackages/plugins/mypackage.output/MyPackage/FooPlugin/Foo.swift"]
I have been unable to fix this.