Skip to content
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

update integration instructions for Cocoapods #420

Closed
wants to merge 2 commits into from

Conversation

arielelkin
Copy link

fixes issues such as #412

In case of an installation via Cocoapods, the path to the check-and-run-apollo-codegen.sh script can be deduced without searching through $FRAMEWORK_SEARCH_PATHS

fixes issues such as apollographql#412

In case of an installation via Cocoapods, the path to the `check-and-run-apollo-codegen.sh` script can be deduced without searching through `$FRAMEWORK_SEARCH_PATHS`
@apollo-cla
Copy link

@arielelkin: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/

If you're using Cocoapods:
```sh
set -exu
sh $PODS_ROOT/Apollo/scripts/check-and-run-apollo-codegen.sh generate $(find . -name '*.graphql') --schema 'path/to/your/schema.json' --output ApolloAPI.swift

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check-and-run-apollo-codegen.sh doesn't seem to be part of the project.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paulmelnikow
Copy link

I'm also running into an issue with FRAMEWORK_SEARCH_PATHS, though this doesn't fix the issue for me.

@paulmelnikow
Copy link

paulmelnikow commented Jan 3, 2019

This script covers both MacOS cases and seems to be getting me closer:

APOLLO_FRAMEWORK_PATH="$(eval find $FRAMEWORK_SEARCH_PATHS -name "Apollo.framework" -maxdepth 1)"
if [ -n "$APOLLO_FRAMEWORK_PATH" ]; then
  APOLLO_CLI=$APOLLO_FRAMEWORK_PATH/Versions/Current/Resources/check-and-run-apollo-cli.sh
elif [ -d "$PODS_ROOT" ]; then
  if [ -d "$PODS_ROOT/Apollo" ]; then
    APOLLO_CLI=$PODS_ROOT/Apollo/scripts/check-and-run-apollo-cli.sh
  else
    echo "error: Couldn't find Apollo in Cocoapods or FRAMEWORK_SEARCH_PATHS; make sure to add it to your project."
    exit 1
  fi
else
  echo "error: Couldn't find Apollo in FRAMEWORK_SEARCH_PATHS; make sure to add the framework to your project."
  exit 1
fi

cd "${SRCROOT}/${TARGET_NAME}"
$APOLLO_CLI codegen:generate --queries="$(find . -name '*.graphql')" --schema=schema.json API.swift

@arielelkin
Copy link
Author

In any case, if you're installing via Cocoapods, the path to the scripts can and should be inferred from the $PODS_ROOT build variable, doing an eval find $FRAMEWORK_SEARCH_PATHS is error-prone.

@arielelkin
Copy link
Author

@paulmelnikow @martijnwalraven any updates?

@designatednerd
Copy link
Contributor

I'm going to close this one out in favor of #610 - there's some stuff that should now be fixed with the framework search paths there as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants