MakeAWishFoundation / SwiftyMocky

Framework for automatic mock generation. Adds a set of handy methods, simplifying testing. One of the best and most complete solutions, including generics support and much more.
MIT License
1.03k stars 104 forks source link

generate from pod does not work #325

Closed dkk closed 1 year ago

dkk commented 1 year ago

generate throws an error.

Notes:

My System:

Model Name: MacBook Pro (16-Inch, 2021)
Model Identifier: MacBookPro18,1
Chip: Apple M1 Pro
Total Number of Cores: 10 (8 performance and 2 efficiency)
Memory: 32 GB
System Firmware Version: 7459.141.1
OS: macOS Monterey (12.6)
Xcode: 14.0

Output:

╰─ ./Pods/SwiftyMocky/bin/swiftymocky generate
╔════════════════════════╗
║ SwiftyMocky CLI v4.1.0 ║
╚════════════════════════╝

Running at: /XXX
Using template from Cocoapods
Processing mock: mocky ...
Using sourcery command: /XXX/Pods/Sourcery/bin/sourcery
Using configuration file at '/XXX/.mocky75DA13CD-2E9F-484B-B6BF-35749AB69499/.config.yml.tmp'
Scanning sources...
Found 135 types in 72 files, 0 changed from last run.
Loading templates...
Loaded 1 templates.
Generating code...
error: error: '1.6.0': Invalid manifest
/private/var/folders/kf/qp0y69697clfgygh_gckx9f40000gq/T/SwiftTemplate/1.6.0/Package.swift:4:8: error: no such module 'PackageDescription'
import PackageDescription
       ^

❌  Error: ShellOut encountered an error
Status code: 3
Message: "error: '1.6.0': Invalid manifest
/private/var/folders/kf/qp0y69697clfgygh_gckx9f40000gq/T/SwiftTemplate/1.6.0/Package.swift:4:8: error: no such module 'PackageDescription'
import PackageDescription
       ^"
Output: "Using configuration file at '/XXX/.mocky75DA13CD-2E9F-484B-B6BF-35749AB69499/.config.yml.tmp'
Scanning sources...
Found 135 types in 72 files, 0 changed from last run.
Loading templates...
Loaded 1 templates.
Generating code...
error: error: '1.6.0': Invalid manifest
/private/var/folders/kf/qp0y69697clfgygh_gckx9f40000gq/T/SwiftTemplate/1.6.0/Package.swift:4:8: error: no such module 'PackageDescription'
import PackageDescription
       ^
"
dkk commented 1 year ago

May be related to https://github.com/MakeAWishFoundation/SwiftyMocky/issues/311

dkk commented 1 year ago

May be related to https://github.com/MakeAWishFoundation/SwiftyMocky/issues/309

dkk commented 1 year ago

Note that pod update currently does not download 4.2.0 since there is no updated spec. However, note that using:

  pod 'SwiftyMocky', '4.1.0'
  pod 'Sourcery', '1.6.0' 

has the same outcome

dkk commented 1 year ago

It seems that it was a general problem with my Xcode Command Line Tools setup. Running sudo xcode-select -s /Applications/Xcode.app/Contents/Developer solved the issue.

dkk commented 1 year ago

Btw. I changed my Podfile to:

  pod 'SwiftyMocky', :git => 'https://github.com/MakeAWishFoundation/SwiftyMocky.git', :tag => '4.2.0'
  pod 'Sourcery', '1.8.0'
mannyvw commented 1 year ago

Am having same problem, forced pod to update to 4.1.0 and made the sudo xcode-select -s /Applications/Xcode.app/Contents/Developer call. still the same problem

❌ Error: ShellOut encountered an error Status code: 3

Did the last thing you mentioned

pod 'SwiftyMocky', :git => 'https://github.com/MakeAWishFoundation/SwiftyMocky.git', :tag => '4.2.0'
pod 'Sourcery', '1.8.0'

Now get ./Pods/SwiftyMocky/bin/swiftymocky: Bad CPU type in executable, mmm

dkk commented 1 year ago

Maybe try to completely clean and rebuild your Pods project:

pod deintegrate
rm Podfile.lock
pod install
VilemKurz commented 1 year ago

Interesting, 4.1.0 works for me on intel without any additional setup. Tested on both Xcode 14 GM (via xcodes) and Xcode 13.4.1 on the default location