Why does Apollo fail to build in Xcode - There can only be one fragment named …?
Using:
- Xcode 10.1
- Apollo 1.9.2
- CocoaPods 1.5.3
- Latest build phase script from Apollo
During Xcode's build phase, when it executes the Apollo GraphQL API script, I get errors for duplicate fragments and operations, a-la:
"There can only be one fragment named..."
or
"There can only be one operation named..."
and the project will refuse to build.
Cleaning the build folder will allow you to build or run the project once more before the errors come back.
xcode apollo
add a comment |
Using:
- Xcode 10.1
- Apollo 1.9.2
- CocoaPods 1.5.3
- Latest build phase script from Apollo
During Xcode's build phase, when it executes the Apollo GraphQL API script, I get errors for duplicate fragments and operations, a-la:
"There can only be one fragment named..."
or
"There can only be one operation named..."
and the project will refuse to build.
Cleaning the build folder will allow you to build or run the project once more before the errors come back.
xcode apollo
add a comment |
Using:
- Xcode 10.1
- Apollo 1.9.2
- CocoaPods 1.5.3
- Latest build phase script from Apollo
During Xcode's build phase, when it executes the Apollo GraphQL API script, I get errors for duplicate fragments and operations, a-la:
"There can only be one fragment named..."
or
"There can only be one operation named..."
and the project will refuse to build.
Cleaning the build folder will allow you to build or run the project once more before the errors come back.
xcode apollo
Using:
- Xcode 10.1
- Apollo 1.9.2
- CocoaPods 1.5.3
- Latest build phase script from Apollo
During Xcode's build phase, when it executes the Apollo GraphQL API script, I get errors for duplicate fragments and operations, a-la:
"There can only be one fragment named..."
or
"There can only be one operation named..."
and the project will refuse to build.
Cleaning the build folder will allow you to build or run the project once more before the errors come back.
xcode apollo
xcode apollo
asked Nov 13 '18 at 23:23
cntrlzcntrlz
464
464
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The issue is that the bash find
command is finding duplicate files in a local DerivedData/
directory! This is caused when:
- You have the
DerivedData/
directory set toRelative
in Xcode - You're using the default build phase script provided by Apollo
Change your build phase script for Apollo from this:
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-cli.sh codegen:generate --queries="$(find . -name '*.graphql')" --schema=schema.json API.swift
to this:
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-cli.sh codegen:generate --queries="$(find . -name '*.graphql' -not -path "*DerivedData/*")" --schema=schema.json API.swift
The Details:
- If you don't care where your Derived Data goes, change the Location setting from
Relative
toDefault
(or any directory Apollo is not looking in). You can find the setting here: Xcode > Preferences > Locations > Derived Data - If you would rather keep your Derived Data where it is, alter the bash find command in the query passed to apollo-cli to exclude the
DerivedData/
folder by appending-not -path "*DerivedData/*"
. You can find the script by going to Project Root > (Target Project) > Build Phases > Generate Apollo GraphQL API, (which you should have added during the installation steps, see here). Make it look like this:$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-cli.sh codegen:generate --queries="$(find . -name '*.graphql' -not -path "*DerivedData/*")" --schema=schema.json API.swift
You might need to delete the DerivedData/
folder one last time from your project folder, and it doesn't hurt to do one last clean (Command + Shift + K
).
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53290954%2fwhy-does-apollo-fail-to-build-in-xcode-there-can-only-be-one-fragment-named%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The issue is that the bash find
command is finding duplicate files in a local DerivedData/
directory! This is caused when:
- You have the
DerivedData/
directory set toRelative
in Xcode - You're using the default build phase script provided by Apollo
Change your build phase script for Apollo from this:
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-cli.sh codegen:generate --queries="$(find . -name '*.graphql')" --schema=schema.json API.swift
to this:
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-cli.sh codegen:generate --queries="$(find . -name '*.graphql' -not -path "*DerivedData/*")" --schema=schema.json API.swift
The Details:
- If you don't care where your Derived Data goes, change the Location setting from
Relative
toDefault
(or any directory Apollo is not looking in). You can find the setting here: Xcode > Preferences > Locations > Derived Data - If you would rather keep your Derived Data where it is, alter the bash find command in the query passed to apollo-cli to exclude the
DerivedData/
folder by appending-not -path "*DerivedData/*"
. You can find the script by going to Project Root > (Target Project) > Build Phases > Generate Apollo GraphQL API, (which you should have added during the installation steps, see here). Make it look like this:$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-cli.sh codegen:generate --queries="$(find . -name '*.graphql' -not -path "*DerivedData/*")" --schema=schema.json API.swift
You might need to delete the DerivedData/
folder one last time from your project folder, and it doesn't hurt to do one last clean (Command + Shift + K
).
add a comment |
The issue is that the bash find
command is finding duplicate files in a local DerivedData/
directory! This is caused when:
- You have the
DerivedData/
directory set toRelative
in Xcode - You're using the default build phase script provided by Apollo
Change your build phase script for Apollo from this:
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-cli.sh codegen:generate --queries="$(find . -name '*.graphql')" --schema=schema.json API.swift
to this:
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-cli.sh codegen:generate --queries="$(find . -name '*.graphql' -not -path "*DerivedData/*")" --schema=schema.json API.swift
The Details:
- If you don't care where your Derived Data goes, change the Location setting from
Relative
toDefault
(or any directory Apollo is not looking in). You can find the setting here: Xcode > Preferences > Locations > Derived Data - If you would rather keep your Derived Data where it is, alter the bash find command in the query passed to apollo-cli to exclude the
DerivedData/
folder by appending-not -path "*DerivedData/*"
. You can find the script by going to Project Root > (Target Project) > Build Phases > Generate Apollo GraphQL API, (which you should have added during the installation steps, see here). Make it look like this:$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-cli.sh codegen:generate --queries="$(find . -name '*.graphql' -not -path "*DerivedData/*")" --schema=schema.json API.swift
You might need to delete the DerivedData/
folder one last time from your project folder, and it doesn't hurt to do one last clean (Command + Shift + K
).
add a comment |
The issue is that the bash find
command is finding duplicate files in a local DerivedData/
directory! This is caused when:
- You have the
DerivedData/
directory set toRelative
in Xcode - You're using the default build phase script provided by Apollo
Change your build phase script for Apollo from this:
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-cli.sh codegen:generate --queries="$(find . -name '*.graphql')" --schema=schema.json API.swift
to this:
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-cli.sh codegen:generate --queries="$(find . -name '*.graphql' -not -path "*DerivedData/*")" --schema=schema.json API.swift
The Details:
- If you don't care where your Derived Data goes, change the Location setting from
Relative
toDefault
(or any directory Apollo is not looking in). You can find the setting here: Xcode > Preferences > Locations > Derived Data - If you would rather keep your Derived Data where it is, alter the bash find command in the query passed to apollo-cli to exclude the
DerivedData/
folder by appending-not -path "*DerivedData/*"
. You can find the script by going to Project Root > (Target Project) > Build Phases > Generate Apollo GraphQL API, (which you should have added during the installation steps, see here). Make it look like this:$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-cli.sh codegen:generate --queries="$(find . -name '*.graphql' -not -path "*DerivedData/*")" --schema=schema.json API.swift
You might need to delete the DerivedData/
folder one last time from your project folder, and it doesn't hurt to do one last clean (Command + Shift + K
).
The issue is that the bash find
command is finding duplicate files in a local DerivedData/
directory! This is caused when:
- You have the
DerivedData/
directory set toRelative
in Xcode - You're using the default build phase script provided by Apollo
Change your build phase script for Apollo from this:
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-cli.sh codegen:generate --queries="$(find . -name '*.graphql')" --schema=schema.json API.swift
to this:
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-cli.sh codegen:generate --queries="$(find . -name '*.graphql' -not -path "*DerivedData/*")" --schema=schema.json API.swift
The Details:
- If you don't care where your Derived Data goes, change the Location setting from
Relative
toDefault
(or any directory Apollo is not looking in). You can find the setting here: Xcode > Preferences > Locations > Derived Data - If you would rather keep your Derived Data where it is, alter the bash find command in the query passed to apollo-cli to exclude the
DerivedData/
folder by appending-not -path "*DerivedData/*"
. You can find the script by going to Project Root > (Target Project) > Build Phases > Generate Apollo GraphQL API, (which you should have added during the installation steps, see here). Make it look like this:$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-cli.sh codegen:generate --queries="$(find . -name '*.graphql' -not -path "*DerivedData/*")" --schema=schema.json API.swift
You might need to delete the DerivedData/
folder one last time from your project folder, and it doesn't hurt to do one last clean (Command + Shift + K
).
answered Nov 13 '18 at 23:23
cntrlzcntrlz
464
464
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53290954%2fwhy-does-apollo-fail-to-build-in-xcode-there-can-only-be-one-fragment-named%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown