-
Notifications
You must be signed in to change notification settings - Fork 176
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
Migrate to v2 with SPM package.swift #508
Comments
After some investigations I managed to run the
to my package definition but now i'm getting the same errors as mentioned in this issue |
Hey, @soucolline, that message is not an error per se, it's only a disclaimer when multiple outputs are defined in Cuckoofile, but I agree that it should be fixed and hidden when the Swift build tool plugin forces the derived data mock output. However, it shouldn't cause any issues otherwise, do the mocks not get generated? Unfortunately I think it's not possible to generate the mocks anywhere else as a Swift build tool plugin, maybe an investigation is in order. |
Hey @MatyasKriz thanks for the answer, the mocks are generated on the derivedData folder when I specify the plugin option in my Package.swift If it's impossible to generate mocks outside of the derivedData maybe a third option with a CLI to generate the mocks whenever you want could work ? So that you don't have to rely on the plugin or a script phase |
I'm not sure I understand, you can simply call the Did I miss something? |
Oh ok I didn't see I could do that. I've tried running cuckoonator script and the mocks are created at the right location with it. I'll continue to dig a bit but it sounds good |
Ok I've migrated everything to 2.0.9 and it's working fine ! The only thing a bit annoying is that Cuckoo is located in the derived data because of how SPM works, the name of the folder is always changing so if I clean the project i need to find again the location of Cuckoo + rerun the run file which takes a bit of time to compile. I'm wondering if it's technically possible to make a complete CLI of Cuckoo (which you would download from homebrew for exemple) ? This way you completely abstract the code generation from Xcode or a dependency manager and it can be run from anywhere (as long as you specify the location of the TOML file) |
I think there's nothing preventing the creation of a CLI which manages the Cuckoonator version (this would allow specifying it in Cuckoofile as well, sounds cool), fetching it if it's not present and running it. Unfortunately I don't have enough free time on my hands to implement it in the foreseeable future. |
For sure that's an idea worth exploring, I'll try to play a bit with it on my side |
Hey @MatyasKriz, I've played a bit with it this week-end and ended up making this repository : https://github.com/soucolline/homebrew-cuckoo It's simply storing the Cuckoonator binary and then you can install it globally using homebrew
This way you can run I find it a great installation + run alternative as it is not dependant on any package manager and can be installed the same using cocoapods / carthage and SPM and doesn't require any script phase or plugin. I'll be maintaining and using it for my work and personal projects but if you want to officially support it one day it's only uploading a targ.gz of the Cuckoonator executable (I've used this https://bharathvaj-ganesan.medium.com/how-to-publish-your-nodejs-application-on-homebrew-7a24de9ea973) |
Thanks for letting me know, perhaps some users will prefer this way of distribution. 🙂 I've been thinking of making the distributed binary a Cuckoonator manager, so that it will automatically make sure it's using the correct generator version to match the project's, but is customizable through Cuckoofile if needed. |
Hi @soucolline , Then I also created .sh file and can run with cmd. |
I have the same workaround @nalounguyen but R.swift, sourcery, swiftgen has their own standalone tool in order to be used like this. I still agree on @soucolline POV. |
I share for the community my script to manually download the cuckoonator from the last version: source .cuckoo-version
if [ ! -f "cuckoonator" ] || [ "$(md5 -q cuckoonator)" != "$CUCKOONATOR_HASH" ]; then
echo "🔵 Downloading Cuckoonator"
curl -L -o cuckoonator https://github.com/Brightify/Cuckoo/releases/latest/download/cuckoonator
chmod 700 cuckoonator
echo "🟢 Cuckoonator successfully downloaded"
else
echo "🔵 Cuckoonator already installed"
fi
if [ ! -f "cuckoonator" ]; then
echo "🔴 Cuckoonator was not downloaded. Can't generate mocks later. Please retry with this command:\ncurl -L -o cuckoonator https://github.com/Brightify/Cuckoo/releases/latest/download/cuckoonator"
exit 1
fi |
this script is support dowload cuckoo and we can use it, right ? |
@aiKrice what does this script do that the official |
I don't need to download the SPM to be able to generate mocks, which is the difference |
https://github.com/Brightify/Cuckoo/blob/master/run this is the |
Hello,
I'm trying to migrate to v2 using SPM with a package.swift file.
I'm updating the dependency to 2.0.9
.package(url: "https://github.com/Brightify/Cuckoo.git", exact: "2.0.9"),
But then I don't have access to the
CuckooPluginSingleFile
mentioned in the doc. Is it only in the case where you install it from Xcode ?Even if I try to launch my tests i'm getting this warning about the file being stalled from my DerivedData, so I supposed it's existing even though i'm not importing it in the
Run Build Tools Plug-ins
phaseAm I missing something there or the install from a
Package.swift
is not supported ?Thanks
The text was updated successfully, but these errors were encountered: