Skip to content

Add TUIST_SWIFT_CONDITIONS for injecting compiler flags at project generation time#6661

Merged
facumenzella merged 3 commits into
mainfrom
facu/tuist-custom-swift-flags
Apr 21, 2026
Merged

Add TUIST_SWIFT_CONDITIONS for injecting compiler flags at project generation time#6661
facumenzella merged 3 commits into
mainfrom
facu/tuist-custom-swift-flags

Conversation

@facumenzella

@facumenzella facumenzella commented Apr 21, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds TUIST_SWIFT_CONDITIONS environment variable that injects arbitrary Swift active compilation conditions into Tuist-generated Xcode project targets
  • Applies to RevenueCat, RevenueCatUI, and PaywallsTester targets when using Xcode project mode (TUIST_RC_XCODE_PROJECT=true)
  • Useful for testing feature-flagged code paths locally without modifying Local.xcconfig

Usage

# Single flag
TUIST_RC_XCODE_PROJECT=true TUIST_SWIFT_CONDITIONS="ENABLE_WORKFLOWS_ENDPOINT" tuist generate PaywallsTester

# Multiple flags
TUIST_RC_XCODE_PROJECT=true TUIST_SWIFT_CONDITIONS="FLAG_A FLAG_B" tuist generate

Test plan

  • Run TUIST_RC_XCODE_PROJECT=true TUIST_SWIFT_CONDITIONS="ENABLE_WORKFLOWS_ENDPOINT" tuist generate PaywallsTester and verify ENABLE_WORKFLOWS_ENDPOINT appears in build settings for RevenueCat, RevenueCatUI, and PaywallsTester targets
  • Run tuist generate PaywallsTester without env vars and verify no flags are added

🤖 Generated with Claude Code


Note

Low Risk
Build-generation-only change that appends optional compiler flags; low blast radius but could change local build behavior if the env var is set incorrectly.

Overview
Adds a new TUIST_SWIFT_CONDITIONS env var to inject additional SWIFT_ACTIVE_COMPILATION_CONDITIONS at Tuist project-generation time.

Introduces SettingsDictionary.appendingTuistSwiftConditions() and applies it to the RevenueCat, RevenueCatUI, and PaywallsTester targets so any provided flags are appended to inherited build settings without modifying repo configs.

Reviewed by Cursor Bugbot for commit fd0990f. Bugbot is set up for automated code reviews on this repo. Configure here.

@facumenzella facumenzella requested review from a team as code owners April 21, 2026 14:19
…neration time

Introduces a generic mechanism to pass arbitrary Swift active compilation
conditions when generating Xcode projects via Tuist. Any target generated
through the Tuist Xcode project mode (TUIST_RC_XCODE_PROJECT=true) will
pick up the flags automatically.

Usage:
  TUIST_RC_XCODE_PROJECT=true TUIST_SWIFT_CONDITIONS="MY_FLAG" tuist generate PaywallsTester
  TUIST_RC_XCODE_PROJECT=true TUIST_SWIFT_CONDITIONS="FLAG_A FLAG_B" tuist generate

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@facumenzella facumenzella force-pushed the facu/tuist-custom-swift-flags branch from e3a4c6e to 97a81ed Compare April 21, 2026 14:21

@rickvdl rickvdl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice, one suggestion :)

Comment thread Tuist/ProjectDescriptionHelpers/Settings.swift Outdated
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@facumenzella

Copy link
Copy Markdown
Member Author

Done, renamed to appendingTuistSwiftConditions() 👍

@facumenzella facumenzella enabled auto-merge (squash) April 21, 2026 14:39
@facumenzella facumenzella merged commit c967010 into main Apr 21, 2026
15 of 17 checks passed
@facumenzella facumenzella deleted the facu/tuist-custom-swift-flags branch April 21, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants