Skip to content

DRY secrets paths via xcconfig - #4858

Merged
mokagio merged 1 commit into
trunkfrom
ainfra-2775-a8c-secrets-prep-in-pocket-casts-ios-dry-xcconfig
Jul 30, 2026
Merged

DRY secrets paths via xcconfig#4858
mokagio merged 1 commit into
trunkfrom
ainfra-2775-a8c-secrets-prep-in-pocket-casts-ios-dry-xcconfig

Conversation

@mokagio

@mokagio mokagio commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

See AINFRA-2775, under AINFRA-1541.

I was looking at #4731 to get it ready for a new round of review and grew overwhelmed by the various changes and the open question of how it should flow in CI vs local (when and how to call the decrypt?) and for internal vs external contributors.

As such, I've decided to extract the parts that are already good in dedicated PRs, and to rework the remainder in isolation.

This PR DRYs the build settings configuration to the paths of the secret files used at build time

The three secrets paths were spelled out in full 16 times across the
project's build configurations, so every relocation of the secrets
directory meant 16 edits and a `pbxproj` diff.
Defining them once in `config/PocketCasts.base.xcconfig`, on top of a
`SECRETS_DIR` variable, reduces that to a single line.

This mirrors a19da50 on the a8c-secrets adoption branch, applied here
against the current secrets directory.

Resolved build settings for the two consuming targets, `podcasts` and
`PreBuildActions`, are byte-identical to before across all four build
configurations.

---

Generated with the help of Claude Code, https://claude.ai/code

Co-Authored-By: Claude Code Opus 5 <noreply@anthropic.com>
@mokagio
mokagio requested a review from a team as a code owner July 30, 2026 04:02
@mokagio
mokagio requested review from kean and removed request for a team July 30, 2026 04:02
@mokagio mokagio self-assigned this Jul 30, 2026
Copilot AI review requested due to automatic review settings July 30, 2026 04:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@claude

claude Bot commented Jul 30, 2026

Copy link
Copy Markdown

Claude finished @mokagio's task in 4m 39s —— View job


PR Review: DRY secrets paths via xcconfig

  • Read the diff (config/PocketCasts.base.xcconfig, podcasts.xcodeproj/project.pbxproj)
  • Trace where the removed build settings were defined and who consumes them
  • Verify the settings still resolve for every target/build phase that needs them
  • Post review

Verdict: LGTM — this is a safe, well-scoped DRY refactor.

I traced each removed setting to confirm nothing breaks. The key mechanism is that config/PocketCasts.{staging,prototype,debug,release}.xcconfig are attached at the PBXProject level (config list BDBD53E717019B290048C8C5, e.g. podcasts.xcodeproj/project.pbxproj:9202), and each of those #include "PocketCasts.base.xcconfig". Project-level build settings are inherited by every target unless overridden, so moving these into base.xcconfig keeps them available everywhere they were before. This is the same pattern already used for DEVELOPMENT_TEAM, MARKETING_VERSION, and PRODUCT_BUNDLE_IDENTIFIER_ROOT, so it's consistent with the existing setup.

Per-setting confirmation:

Setting Was defined on Consumed by Still resolves?
SECRETS_PATH podcasts project-level configs (had the xcconfig) scripts/build-phases/generate-credentials.sh (runs under the PreBuildActions aggregate target) ✅ project-level → inherited by aggregate target
FIREBASE_SECRETS_PATH podcasts project-level configs generate-credentials.sh ✅ same
GOOGLE_SIGN_IN_SECRETS_PATH podcasts app target configs + PreBuildActions aggregate configs (no xcconfig on either) scripts/build-phases/post-build-update-plist.sh (Modify Plist phase on the podcasts app target) ✅ now comes from project-level inheritance

Notably, the GOOGLE_SIGN_IN_SECRETS_PATH copies that lived on the PreBuildActions aggregate target were effectively redundant — none of that target's phases (GenerateCredentials, L10n, Colors, SwiftLint) read it — so removing them is pure cleanup. The only real consumer, post-build-update-plist.sh, runs on the podcasts app target, which inherits the value from the project-level xcconfig. All removed values were byte-for-byte identical to what base.xcconfig now defines, so there's no behavioral change.

Extra nits (all optional, non-blocking):

  • Nice touch: the SECRETS_DIR intermediate variable removes the repeated path prefix — good call.
  • External contributors: generate-credentials.sh short-circuits on LocalApiCredentials.swift before touching $SECRETS_PATH, so defining these paths unconditionally at project level doesn't affect the local-secrets flow.
  • Verification I couldn't run: this environment is Linux with no Xcode, so I couldn't run an actual build to confirm the settings resolve at build time. Worth a quick local make build_staging (and ideally a Prototype/Release archive) to double-check the PreBuildActions env and the Modify Plist post-build phase still pick up the paths, since those are the two spots relying on inheritance rather than a direct definition.
    · ainfra-2775-a8c-secrets-prep-in-pocket-casts-ios-dry-xcconfig

@mokagio mokagio added the [Type] Tooling Issues related to tooling: build tools, ruby, scripts, etc. label Jul 30, 2026
@mokagio mokagio added this to the 8.18 milestone Jul 30, 2026
@mokagio
mokagio requested a review from a team July 30, 2026 04:19
@mokagio
mokagio enabled auto-merge July 30, 2026 04:24

SECRETS_DIR = $(HOME)/.configure/pocketcasts-ios/secrets
FIREBASE_SECRETS_PATH = $(SECRETS_DIR)/GoogleService-Info.plist
SECRETS_PATH = $(SECRETS_DIR)/pocket_casts_credentials.json

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This SECRETS_PATH is quite a generic variable name for something specific to pocket_casts_credentials.json, and makes it not clear to distinguish from this SECRET_PATH not meaning "the path to the secrets folder" (which is what SECRET_DIR is for) or from this being any other secret file (like GoogleService-Info.plist or any other).

I'd thus recommend to rename the variable to something more explicit, like PC_CREDENTIALS_JSON_PATH or something.

(Maybe that's something you only had in mind for a separate, follow-up PR, though? 🤷 )

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Whoops I didn't realize auto-merge was on. I guess follow-up PR it will be, then 🙃

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We'll touch this file again when changing to a8c-secrets. I'll try to remember.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll try to remember.

Actually, that's a recipe for failure. Handed it over to an agent...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call — done in #4868, as CREDENTIALS_JSON_PATH.

I skipped the PC_ prefix: these build settings are Pocket Casts-only, so it'd be redundant here.

Posted by Claude Code (Opus 5) on behalf of @mokagio with approval.

@mokagio
mokagio merged commit d4a8122 into trunk Jul 30, 2026
7 of 8 checks passed
@mokagio
mokagio deleted the ainfra-2775-a8c-secrets-prep-in-pocket-casts-ios-dry-xcconfig branch July 30, 2026 13:19
pull Bot pushed a commit to Mu-L/pocket-casts-ios that referenced this pull request Aug 3, 2026
`SECRETS_PATH` reads as "the path to the secrets folder" — which is what
`SECRETS_DIR` is — or as the path to any one of the secret files.
It points at `pocket_casts_credentials.json` specifically, so name it after that.

Follow-up to the review of Automattic#4858:
Automattic#4858 (comment)

---

Generated with the help of Claude Code, https://claude.ai/code

Co-Authored-By: Claude Code Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Tooling Issues related to tooling: build tools, ruby, scripts, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants