Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.42.0 bug: The element XCLocalSwiftPackageReference is not supported when generating mocks with Mockingbird #1508

Open
KonDouvris opened this issue Oct 2, 2024 · 2 comments

Comments

@KonDouvris
Copy link

I have the following problem.

I am using Mockingbird (https://github.com/typealiased/mockingbird) for mocking.
When i am building my test target, i get an error in my generate mockingbird mocks custom shell script.

The script is the following:

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 "develop" "developTests"

In my project.yml i have the following target:

  developTests:
    type: bundle.unit-test
    platform: iOS
    settings:
    dependencies:
      - target: develop
      - package: Mockingbird
    sources:
      - path: appTests
      - path: MockingbirdMocks
        optional: true
    preBuildScripts:
      - path: ./bin/mockingbird.sh
        name: Generate Mockingbird Mocks
        outputFiles:
          - $(SRCROOT)/MockingbirdMocks/developMocks.generated.swift
          - $(SRCROOT)/MockingbirdMocks/developTestsMocks.generated.swift
        basedOnDependencyAnalysis: false

The problem started when update xcodegen to 2.42.0.
I am using MacOS Sequoia 15, and XCode 16.0.0

Any help would be highly appreciated.
Thanks in advance!

@victorsaccucci
Copy link

Hello, good afternoon. Is your problem still ongoing?

Try:

Check the Dependencies:
Make sure all dependencies are installed correctly. You can try running the following command in the terminal to ensure that Mockingbird is updated: "swift package update".

Review the Script:
Check if the path of Mockingbird in your script is correct. It should point to the correct location of the Mockingbird executable. The command in your script is: "${DERIVED_DATA}/SourcePackages/checkouts/mockingbird/mockingbird generate --targets develop developTests".

Make sure that the directory "SourcePackages/checkouts/mockingbird" actually contains the executable "mockingbird". You can use a command like "ls" to check this: "ls ${DERIVED_DATA}/SourcePackages/checkouts/mockingbird".

Check the Version of Mockingbird:
Sometimes, dependency versions can cause issues. Check if the version of Mockingbird you are using is compatible with Xcode version 16.0.0. Refer to the Mockingbird documentation to verify the supported versions.

@KonDouvris
Copy link
Author

@victorsaccucci Hello and sorry for the late reply, i was away.
Problem is still happening. Everything was working before i upgrade xcodegen to 2.42.0, so i don't know if i should start changing things regarding Mockingbird etc.

Do you have any ideas what changes in the latest xcodegen version could have introduced this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants