Graph QL 脚本可以运行

问题描述 投票:0回答:1

我是 grapQl 的新手。我正在尝试使用 script 生成代码。我已将脚本添加到构建阶段,但有任何理由显示以下错误..我已经像这样手动添加了插件..

/Users/test/Library/Developer/Xcode/DerivedData/QL-ffdpoxkzuezgcvehdtxkwmpnuxjl/Build/Intermediates.noindex/QL.build/Debug-iphonesimulator/QL.build/Script-52B35D7229B6257F006710FD.sh:第 23 行:/Users/test /Library/Developer/Xcode/DerivedData/QL-ffdpoxkzuezgcvehdtxkwmpnuxjl/SourcePackages/checkouts/apollo-ios/scripts/run-bundled-codegen.sh: 没有那个文件或目录 命令 PhaseScriptExecution 失败,退出代码非零

这是脚本代码..

# Go to the build root and search up the chain to find the Derived Data Path where the source packages are checked out.
DERIVED_DATA_CANDIDATE="${BUILD_ROOT}"

while ! [ -d "${DERIVED_DATA_CANDIDATE}/SourcePackages" ]; do
  if [ "${DERIVED_DATA_CANDIDATE}" = / ]; then
    echo >&2 "error: Unable to locate SourcePackages directory from BUILD_ROOT: '${BUILD_ROOT}'"
    exit 1
  fi

  DERIVED_DATA_CANDIDATE="$(dirname "${DERIVED_DATA_CANDIDATE}")"
done

# Grab a reference to the directory where scripts are checked out
SCRIPT_PATH="${DERIVED_DATA_CANDIDATE}/SourcePackages/checkouts/apollo-ios/scripts"

if [ -z "${SCRIPT_PATH}" ]; then
    echo >&2 "error: Couldn't find the CLI script in your checked out SPM packages; make sure to add the framework to your project."
    exit 1
fi

cd "${SRCROOT}/${TARGET_NAME}"
"${SCRIPT_PATH}"/run-bundled-codegen.sh codegen:generate --target=swift --includes=./**/*.graphql --localSchemaFile="schema.json" API.swift

这是我添加文件时的截图..

ios swift graphql apollo
1个回答
0
投票

假设 .graphql 文件和 schema.json 的相对路径如脚本所示正确,根据 Apollo Docs

,也许您应该移动运行脚本以在目标依赖项和编译资源之间执行
© www.soinside.com 2019 - 2024. All rights reserved.