You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have recently run into a weird issue with mocking in our iOS unit tests.
Mocking and our unit tests works just fine locally and it has also worked fine when building on Xcode Cloud.
Until recently, when it started to throw this error:
Operation '<MockingbirdGenerator.GenerateFileOperation: 0x7fb81740beb0>' failed with error 'Error Domain=NSCocoaErrorDomain Code=516 "“AppNameMocks.generated.swift” couldn’t be moved to “MockingbirdMocks” because an item with the same name already exists."
From the error message the problem is quite obvious, but there are not changes to our the post build script, which have worked fine for almost a year on Xcode Cloud.
Our PostBuildScript looks like this:
set -eu
# Prevent Xcode 13 from running this script while indexing.
[[ "${ACTION}" == "indexbuild" ]] && exit 0
# Infer the derived data location from the build environment.
[[ -z "${DERIVED_DATA+x}" ]] && DERIVED_DATA="$(echo "${BUILD_ROOT}" | sed -n 's|\(.*\)/Build/.*|\1|p')"
"${DERIVED_DATA}/SourcePackages/checkouts/mockingbird/mockingbird" generate --targets "AppName" "AppName" --outputs "${SRCROOT}/MockingbirdMocks/AppNameMocks.generated.swift" "${SRCROOT}/MockingbirdMocks/AppNameMocks.generated.swift"
Environment
Mockingbird via SPM version 0.20.0
Xcode 15.4 and Swift version 5.2
Swift Package manager
XCTest
Custom configuration
none
The text was updated successfully, but these errors were encountered:
I found that we have two targets after each other in the command and the output defined twice, in the command.
Reducing this to one target and one output parameter fixed it. Don't know how this worked for 1+ year.
Also; the documentation is extremely thin and actually wrong compared to the example (if you look at the post build script).
New Issue Checklist
Overview
I have recently run into a weird issue with mocking in our iOS unit tests.
Mocking and our unit tests works just fine locally and it has also worked fine when building on Xcode Cloud.
Until recently, when it started to throw this error:
From the error message the problem is quite obvious, but there are not changes to our the post build script, which have worked fine for almost a year on Xcode Cloud.
Our PostBuildScript looks like this:
Environment
The text was updated successfully, but these errors were encountered: