Apollo-GraphQL codegen phase support

Apollo GraphQL has the codegen build time phase (before compiling). It produces a .swift file needed for the code to work.
Now the code I pushed has the file that was previously generated so I do not need this codegen phase on Bitrise to run but I do not want to remove it from xcode before I push and then re-enter it again.

Anyone has a better idea?

It fails with this error.

error: Can’t find apollo-codegen command; make sure to run ‘npm install -g apollo-codegen’ first.

Hi @ramsay,

Thanks for asking this here! :slight_smile:

One solution might be to configure your Xcode project so that only a specific Scheme runs the apollo build phase script.

That way you can run that Scheme locally, and use a different Scheme on bitrise.io which won’t run it.

As our steps simply run the Xcode tools (xcodebuild command line tool) it means it’ll do the same build it would on your own Mac if you click Test/Build/Archive. So all you have to do is to figure out a way in local how you can skip this. One solution might be the separate Scheme approach I mentioned above, or maybe to depend on some kind of environment variable…

Maybe you could add a check to your Build Phase Script to not to run it if CI env var is defined (which is usually defined on CI services, and it’s always defined by our CLI: http://devcenter.bitrise.io/faq/available-environment-variables/#exposed-by-the-bitrise-cli). I’d still say that the separate Scheme/Config in Xcode is probably a cleaner / more maintainable solution, but this should also work :slight_smile:

If you’d have any questions just let us know! :wink: