yonaskolb / XcodeGen

A Swift command line tool for generating your Xcode project
MIT License
6.88k stars 809 forks source link

XcodeGenKit/resource_bundle_accessor.swift:44: Fatal error: unable to find bundle named XcodeGen_XcodeGenKit #1445

Closed persidskiy closed 4 months ago

persidskiy commented 4 months ago

XcodeGen: 2.39.0 Xcode: 15.2

When I run the latest xcodegen, I see this error:

⚙️  Generating plists...
⚙️  Generating project...
XcodeGenKit/resource_bundle_accessor.swift:44: Fatal error: unable to find bundle named XcodeGen_XcodeGenKit
[1]    3755 trace trap  xcodegen

There were no such errors in version 2.38.0.

freddi-kit commented 4 months ago

It may be my fault due to artifact bundle, let me research

freddi-kit commented 4 months ago

Are you using XcodeGen from Swift Package? And what commands are you using?

persidskiy commented 4 months ago

@freddi-kit I download the binary from the Github releases page. I use xcodegen command to generate from the local project.yml file. You can checkout the repo and try it locally

OdNairy commented 4 months ago

@freddi-kit Here is the code we use to download xcodegen on the CircleCI:

XCODEGEN_DIR="$HOME/xcodegen" && mkdir -p $XCODEGEN_DIR
curl -L -f https://github.com/yonaskolb/XcodeGen/releases/download/2.38.0/xcodegen.zip -o "${HOME}/xcodegen.zip"
unzip "${HOME}/xcodegen.zip" -d "${XCODEGEN_DIR}/"
echo 'export PATH="$HOME/xcodegen/xcodegen/bin:$PATH"' >> $BASH_ENV
source $BASH_ENV
freddi-kit commented 4 months ago

I see, I'm sorry because I'm busy so let me investigate at Sunday in Japanese Time ... 🙇🙇🙇

freddi-kit commented 4 months ago

Or you can see my PR to how to fix it, please check my pr what I changed

freddi-kit commented 4 months ago

It's #1388. My change may wrong on loading Bundle

kkebo commented 4 months ago

By this change and this Bundle.module, the xcodegen command now seems to require XcodeGen_XcodeGenKit.bundle at runtime.

So, as a workaround, you can run xcodegen successfully by copying XcodeGen_XcodeGenKit.bundle from xcodegen.artifactbundle.zip into bin.

XCODEGEN_DIR="$HOME/xcodegen" && mkdir -p $XCODEGEN_DIR
curl -L -f https://github.com/yonaskolb/XcodeGen/releases/download/2.39.0/xcodegen.zip -o "${HOME}/xcodegen.zip"
unzip "${HOME}/xcodegen.zip" -d "${XCODEGEN_DIR}/"

curl -LO https://github.com/yonaskolb/XcodeGen/releases/download/2.39.0/xcodegen.artifactbundle.zip
unzip xcodegen.artifactbundle.zip
cp -rp xcodegen.artifactbundle/xcodegen-2.39.0-macosx/bin/XcodeGen_XcodeGenKit.bundle "$XCODEGEN_DIR/xcodegen/bin/"

echo 'export PATH="$HOME/xcodegen/xcodegen/bin:$PATH"' >> $BASH_ENV
source $BASH_ENV

Or, you can just use xcodegen.artifactbundle.zip instead of xcodegen.zip like this:

XCODEGEN_DIR="$HOME/xcodegen" && mkdir -p $XCODEGEN_DIR
curl -L -f https://github.com/yonaskolb/XcodeGen/releases/download/2.39.0/xcodegen.artifactbundle.zip -o "${HOME}/xcodegen.artifactbundle.zip"
unzip "${HOME}/xcodegen.artifactbundle.zip" -d "${XCODEGEN_DIR}/"

echo 'export PATH="$HOME/xcodegen/xcodegen.artifactbundle/xcodegen-2.39.0-macosx/bin:$PATH"' >> $BASH_ENV
source $BASH_ENV
daltonclaybrook commented 4 months ago

I am experiencing this issue as well. Installing XcodeGen on CI using mint install yonaskolb/xcodegen

kkebo commented 4 months ago

@daltonclaybrook What version of Mint are you using? I'm using Mint 0.17.5 and have no issues. Mint versions older than 0.17.2 do not copy bundles.

https://github.com/yonaskolb/Mint/releases

daltonclaybrook commented 4 months ago

I'm using 0.17.5 as well. Installing mint on CI with brew install mint

kkebo commented 4 months ago

I don't know why that issue didn't occur on my side, but your issue may be related to the following issue.

https://github.com/yonaskolb/Mint/issues/261

yonaskolb commented 4 months ago

Can anyone having issues confirm that 2.39.1 fixes the issue?

freddi-kit commented 4 months ago

~@yonaskolb it looks binaryxcodegen.artifactbundle.zip is still 2.39.0 in https://github.com/yonaskolb/XcodeGen/releases/tag/2.39.1~

freddi-kit commented 4 months ago

sorry, please ignore above my comment

freddi-kit commented 4 months ago

It looks fixed from my sight with released binary in https://github.com/yonaskolb/XcodeGen/releases/tag/2.39.1

persidskiy commented 4 months ago

The fix works, thank you all!