apollographql / apollo-ios

📱  A strongly-typed, caching GraphQL client for iOS, written in Swift.
https://www.apollographql.com/docs/ios/
MIT License
3.86k stars 714 forks source link

Will the steps from "Swift scripting (beta)" ever be done automatically in the future? #1234

Open joshuarobs opened 4 years ago

joshuarobs commented 4 years ago

I'm curious if the steps here at https://www.apollographql.com/docs/ios/swift-scripting/ will ever be done automatically in the future, i.e. automatically either through 1 click of a script or as part of a swift package or something?

I'm just wondering since it may be a little tedious having to go through all the steps manually for every new project

designatednerd commented 4 years ago

I agree wholeheartedly that it's annoying. This is where I wish Xcode supported plugins for more than syntax highlighting. 😭

What are the steps in particular that you're thinking should be automated? Would it work to have a "Here's the whole script for you to copy" at the bottom of of the page if people don't want to go through the individual steps?

joshuarobs commented 4 years ago

I suppose given how the Codegen folder is generated, perhaps a completed zip file that contains all of the code and folders that people could download and add into their project? Then the only thing they'd have to do is to add the script in their Build Phases in their main project file. This isn't the 1-click perfect automatic deployment we'd hope for, but it'd erase about 90% of the effort and make it easier for users.

designatednerd commented 4 years ago

I'll certainly look into it, but given that all projects are structured differently and named differently, there's going to necessarily be some stuff that people will need to fill in themselves.

designatednerd commented 4 years ago

I saw something in one of the SPM sessions at WWDC about the possibility of including scripts in the package as resources - I'll dive a bit deeper into that and see if there's something we can do here to autogenerate.

calvincestari commented 2 years ago

Hi 👋🏻 - we've taken this into consideration and decided to defer it to a future 1.x release. We're not rejecting nor closing this issue but it's not on the roadmap yet. If this issue is important to you please let us know in this issue and it will help with prioritization - thank you!

CaioSym commented 1 year ago

Attempting to revive this issue now that SPM has proper support for build plugins. This is actually rather easy as long as we can get an executable as a binary target from somewhere on the web.

calvincestari commented 1 year ago

You'll be please to know then that support for SPM plugins has already been added. Take a look at the release/1.0 branch.

CaioSym commented 1 year ago

Oh. Thanks for the update! I missed that.

That being said looks like all the added plugins are Command plugins. Ideally for my projects I'd like to preserve the behavior to generate the files as a build script.

This is actually possible now that SPM has support for build extensions and I have a local branch on a project with such a plugin. The main issue is some conventions are needed in order for build plugins to be reusable. I can try opening a PR if that is of interest to the maintainers?

calvincestari commented 1 year ago

This is actually possible now that SPM has support for build extensions and I have a local branch on a project with such a plugin. The main issue is some conventions are needed in order for build plugins to be reusable. I can try opening a PR if that is of interest to the maintainers?

I'm happy to work with you on any suggestion and see whether it's a fit for the project. In the interest of not committing to work without agreement maybe you could detail a solution, including any conventions, and we can work through that first. Once we've agreed on that solution then we can move to a PR. Does that sound OK to you?