Comments (11)
So just to be clear, the supported fix for the whitespace issue is:
- change all the paths on your local file system to not contain a white space
- ensure your schemes dont contain whitespace
- ensure your target does not contain whitespace
- ensure your product name does not contain whitespace
- change the documentation script to not run during archive or release?
:\
from apollo-ios.
@plm75: Thanks for reporting this! The solution is to quote both the eval find
result and the cd
argument. This should do the trick:
APOLLO_FRAMEWORK_PATH="$(eval find $FRAMEWORK_SEARCH_PATHS -name "Apollo.framework" -maxdepth 1)"
if [ -z "$APOLLO_FRAMEWORK_PATH" ]; then
echo "error: Couldn't find Apollo.framework in FRAMEWORK_SEARCH_PATHS; make sure to add the framework to your project."
exit 1
fi
cd "${SRCROOT}/${TARGET_NAME}"
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh generate $(find . -name '*.graphql') --schema schema.json --output API.swift
I'll also change this in the documentation.
from apollo-ios.
I am still running into this for spaces in build product names (ex. "App Store").
(I should preface all this by saying that I'm a bash newbie)
The shell performs field splitting on any command not enclosed by double quotes so the last line is still problematic. To fix this it should be:
"$APOLLO_FRAMEWORK_PATH"/check-and-run-apollo-codegen.sh generate $(find . -name '*.graphql') --schema schema.json --output API.swift
or, I believe (haven't checked this), by explicitly wrapping the first line with escaped quotes:
APOLLO_FRAMEWORK_PATH="\"$(eval find $FRAMEWORK_SEARCH_PATHS -name "Apollo.framework" -maxdepth 1)\""
This allows me to archive successfully, but the find
on the first line still emits errors (yet still passes the correct the APOLLO_FRAMEWORK_PATH):
find: /Users/bchrobot/Library/Developer/Xcode/DerivedData/[AppName]-dkvjdqgnjeupezbhjvehrcicivup/Build/Intermediates/ArchiveIntermediates/[AppName]/BuildProductsPath/App: No such file or directory
find: Store-iphoneos: No such file or directory
# I added an `echo $APOLLO_FRAMEWORK_PATH` to the build script as a sanity check
framework path: /Users/bchrobot/Library/Developer/Xcode/DerivedData/[AppName]-dkvjdqgnjeupezbhjvehrcicivup/Build/Intermediates/ArchiveIntermediates/[AppName]/BuildProductsPath/App Store-iphoneos/Apollo/Apollo.framework
++ exec apollo-codegen generate [.graphql files] --schema [schema.json] --output [API.swift]
Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure
I understand what the goal of the first line is, but do not understand the use of eval
. $FRAMEWORK_SEARCH_PATHS
contains (or should at least) all double-quote enclosed paths so find
should not have a problem with it. It seems like the following might make more sense:
APOLLO_FRAMEWORK_PATH=$(find $FRAMEWORK_SEARCH_PATHS -name 'Apollo.framework' -maxdepth 1)
but find
then complains that the "filename [is] too long".
from apollo-ios.
@bchrobot: Sorry, this one fell through the cracks because the issue was already closed and I missed the notification.
You're right that $APOLLO_FRAMEWORK_PATH
needs to be quoted on the last line. And as you mention, that should at least make the project build.
That still leaves us with the errors emitted from find
however. I did some digging, but I haven't been able to find a fix yet.
To start with your question, eval
is needed to make sure the paths in FRAMEWORK_SEARCH_PATHS
are passed to find
as separate arguments. That also explains the filename [is] too long
error, because without it find
interprets the contents of FRAMEWORK_SEARCH_PATHS
as one path.
The errors emitted by find
occur because FRAMEWORK_SEARCH_PATHS
isn't properly split into paths. It seems Xcode prepends FRAMEWORK_SEARCH_PATHS
with BUILT_PRODUCTS_DIR
when initializing environment variables for a 'Run Script' phase, but without quoting BUILT_PRODUCTS_DIR
!
export FRAMEWORK_SEARCH_PATHS="/Users/martijnwalraven/Library/Developer/Xcode/DerivedData/Conference_Planner-akghafttjpxtjbdsfslsdcpuertp/Build/Intermediates/ArchiveIntermediates/Conference Planner/BuildProductsPath/Release-iphoneos \"/Users/martijnwalraven/Library/Developer/Xcode/DerivedData/Conference_Planner-akghafttjpxtjbdsfslsdcpuertp/Build/Intermediates/ArchiveIntermediates/Conference Planner/BuildProductsPath/Release-iphoneos/Apollo\""
This seems like an Xcode bug to me, but I may be missing something. Do you have any ideas what could be going on, or suggestions on how we could fix this?
from apollo-ios.
@martijnwalraven thank you for the explanation about eval
- that makes sense, although I'm surprised that find
doesn't treat FRAMEWORK_SEARCH_PATHS
correctly.
I tried playing around with this some more yesterday with some progress. My thought process was to loop over each path in FRAMEWORK_SEARCH_PATHS
, swallow find errors, break if the framework was found, and then proceed with the rest of the current script (after the first line).
I haven't been able to get the find
part working yet. Going for the bash equivalent of:
if let frameworkPath = try? find(...)
but again, I don't do a whole lot with bash.
This issue may also be causing problems with Fastlane's gym build tool. I'm not 100% sure about that but I have been running into some issues with fastlane builds and know that gym is less tolerant about errors than xcodebuild
.
from apollo-ios.
I still get this issue. Our target's name has "App Store" in it, and I get this error when I try to archive it:
/Users/huyanh/Library/Developer/Xcode/DerivedData/Hecatea-ftdvyqwnnvpowzhkmqgdtakxkzja/Build/Intermediates.noindex/ArchiveIntermediates/Hecatea (App Store)/IntermediateBuildFilesPath/Hecatea.build/Release-iphoneos/Hecatea.build/Script-3B6ABB0E1F7B274600480825.sh: eval: line 2: syntax error near unexpected token `('
Of course, line 2 being:
APOLLO_FRAMEWORK_PATH="$(eval find $FRAMEWORK_SEARCH_PATHS -name "Apollo.framework" -maxdepth 1)"
The problem does not occur when I build it normally to the simulator, however. Does Archive
build apps differently or am I missing something?
from apollo-ios.
Reopening this because we haven't found a solution that works for archive builds.
As a workaround, I would recommend skipping the script when archiving and performing a regular build before to make sure the generated code is up to date.
from apollo-ios.
Any updates on this issue?
I'm going to remove whitespace from my schemas, but anyway maybe something has changed or we have some workaround )
from apollo-ios.
Manual fix is to modify the Generate Apollo GraphQL API
build phase script.
Add at the top of the script:
// Do not run in the Release configuration
if [ "${CONFIGURATION}" = "Release" ]; then
exit 0
fi
Then the script won't be ran when archiving.
from apollo-ios.
Am unable to generate the API.swift file. I have generated schema.json, installed the frameworks and all other stuffs. but still stucking here, please suggest some solution.
from apollo-ios.
This should be addressed by updates to the build scripts from #610 pushed with 0.11.0. Please open a new issue if you are still having problems!
from apollo-ios.
Related Issues (20)
- Deprecate `legacyResponse` and prepare for partial/incremental caching HOT 2
- Custom scalar isn't being respected HOT 7
- @defer issue HOT 8
- Documentation for @import directive. HOT 9
- Add debugDescription api for Apollo generated types
- Circular reference Build Error HOT 6
- Invalid redeclaration of synthesized property '_id' HOT 7
- Split/Hybrid Caching between InMemory and SQL review and thoughts HOT 2
- ID as a custom scalar HOT 6
- Bug: Cache writes of incremental responses uses incorrect parent key (custom cache keys)
- Incorrect PR link in release notes for version 1.11.0 HOT 2
- apollo-ios-cli deprecated --schema-name HOT 2
- Confused about cache behavior HOT 2
- CLI fails to run with 1.12.0 HOT 4
- Response value getting nil HOT 2
- Version mismatch between package and CLI HOT 3
- Pagination: Pager does not provide updates during a refresh HOT 6
- Slow compilation speed when migrating from 0.x to 1.12.2 HOT 4
- clearCache for SQLiteNormalizedCache doesn't clear the sqlite file HOT 3
- Crash on com.apollographql.websocket on _inputStreamCallbackFunc HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apollo-ios.