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

Remove code generation during the build phase #387

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 5 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,17 @@ fi

```

- There should also be another run script labeled **UpliftAPI** If not, create a **New Run Script Phase** with the following script:

```bash
CLI_PATH="./Pods/Apollo/apollo-ios-cli"
SECRETS_PATH="${SRCROOT}/TransitSecrets"

if [ "${CONFIGURATION}" != "Release" ]; then
CONFIG_PATH="${SECRETS_PATH}/uplift-codegen-config-dev.json"
fi

if [ "${CONFIGURATION}" = "Release" ]; then
CONFIG_PATH="${SECRETS_PATH}/uplift-codegen-config-prod.json"
fi
5. Select the `TCAT Debug` schema to use our development server and `TCAT Release` to use our production server.
6. Generate the Uplift API:

"${CLI_PATH}" generate -p "${CONFIG_PATH}" -f
- Dev: `./Pods/Apollo/apollo-ios-cli generate -p "TransitSecrets/uplift-codegen-config-dev.json" -f`
- Prod: `./Pods/Apollo/apollo-ios-cli generate -p "TransitSecrets/uplift-codegen-config-prod.json" -f`

```

5. Select the `TCAT Debug` schema to use our development server and `TCAT Release` to use our production server.
6. Generate the Uplift API with the following command: `./Pods/Apollo/apollo-ios-cli generate -p "TransitSecrets/uplift-codegen-config-dev.json" -f`
7. Build the project and you should be good to go.

## Common Issues

- If the build script for generating the API folder doesn't work, you can manually generate the API via `./Pods/Apollo/apollo-ios-cli generate -p "TransitSecrets/uplift-codegen-config-dev.json" -f`
- If the API is not working properly, try manually generating the API with the CLI.

- If UpliftAPI is not detected or if your new written queries/mutations are not generated by Apollo, make sure that the generated UpliftAPI folder is linked to the TCAT target. You can do this by simply deleting the UpliftAPI group via the project navigator on Xcode and dragging the generated UpliftAPI folder from Finder to Xcode.

Expand Down
20 changes: 0 additions & 20 deletions TCAT.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,6 @@
2292F9DB215722ED00C8C931 /* SwiftLint */,
7E14AED52177E846006A344D /* Embed Foundation Extensions */,
CE26CBF62B879837005D099A /* Crashlytics */,
2E9416612BC60AE7003DEB44 /* UpliftAPI */,
882B9E91268F347446806E32 /* [CP] Embed Pods Frameworks */,
0B4CA64206AF6DA1763F9ACB /* [CP] Copy Pods Resources */,
);
Expand Down Expand Up @@ -743,25 +742,6 @@
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/SwiftLint/swiftlint\"\n\nif which swiftlint >/dev/null; then\n swiftlint --fix && swiftlint\nelse\n echo \"WARNING: SwiftLint not installed\"\nfi\n";
};
2E9416612BC60AE7003DEB44 /* UpliftAPI */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = UpliftAPI;
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "CLI_PATH=\"./Pods/Apollo/apollo-ios-cli\"\nSECRETS_PATH=\"${SRCROOT}/TransitSecrets\"\n\nif [ \"${CONFIGURATION}\" != \"Release\" ]; then\n CONFIG_PATH=\"${SECRETS_PATH}/uplift-codegen-config-dev.json\"\nfi\n\nif [ \"${CONFIGURATION}\" = \"Release\" ]; then\n CONFIG_PATH=\"${SECRETS_PATH}/uplift-codegen-config-prod.json\"\nfi\n\n\"${CLI_PATH}\" generate -p \"${CONFIG_PATH}\" -f\n";
};
882B9E91268F347446806E32 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down