Skip to content

Conversation

@hbugdoll
Copy link
Contributor

@hbugdoll hbugdoll commented Nov 28, 2025

Introduction:

These warnings have caused confusion for several times, particularly as false positive errors ([1], [2], [3], [4], [5]):

warning: Conditional compilation flags do not have values in Swift; they are either present or absent (rather than 'DEPLOYTYPE=development') ...
warning: Conditional compilation flags do not have values in Swift; they are either present or absent (rather than '__LOG__ID__=******')  ...
warning: Conditional compilation flags do not have values in Swift; they are either present or absent (rather than 'DEBUG=1')  ...
warning: Conditional compilation flags do not have values in Swift; they are either present or absent (rather than 'LAUNCHSCREEN_STORYBOARD=1')  ...
warning: Conditional compilation flags do not have values in Swift; they are either present or absent (rather than 'DEFAULT_BGCOLOR_RED=1')  ...
warning: Conditional compilation flags do not have values in Swift; they are either present or absent (rather than 'DEFAULT_BGCOLOR_GREEN=1')  ...
warning: Conditional compilation flags do not have values in Swift; they are either present or absent (rather than 'DEFAULT_BGCOLOR_BLUE=1')  ...
warning: Conditional compilation flags do not have values in Swift; they are either present or absent (rather than 'DISABLE_TI_LOG_SERVER=1')  ...

The values of the Swift compiler variable SWIFT_ACTIVE_COMPILATION_CONDITIONS are copied from GCC_PREPROCESSOR_DEFINITIONS in iphone/iphone/Titanium.xcodeproj/project.pbxproj.
But SWIFT_ACTIVE_COMPILATION_CONDITIONS doesn't allow key-value pairs,
only a list of conditional compilation flags like in TI_SYMBOL_MACROS – that is why the above warnings are raised.

Note

My initial naive solution did not work because the Swift compiler does not support key-value compiler flags at all!

But do we even need key-value compiler flags?
Of course, it's a simple "traditional" way – easy to maintain.
But I don't think so in this case. So far, they have only been used in main.m.
And in my opinion, compiler optimizations will make the minimal performance advantage for these few values obsolete.

  1. The DEPLOYTYPE flag was no longer used at all; instead, TI_APPLICATION_DEPLOYTYPE is available.
  2. The __LOG__ID__ flag is not needed because it has exactly the same value as TI_APPLICATION_GUID; instead, introduction of a conditional flag LOGTOFILE is sufficient.
  3. Only the following flags remain: TI_LOG_SERVER_PORT and DEFAULT_BGCOLOR_RED/..._GREEN/..._BLUE. These four can easily be replaced as templated values in writeMain() too, analogous to App-ID/GUID/etc.

Description:

  • splitted transferred non-key-value flags of GCC_PREPROCESSOR_DEFINITIONS for use with Swift into to
    • SWIFT_ACTIVE_COMPILATION_CONDITIONS (conditional compilation flags)
    • andOTHER_SWIFT_FLAGS (key-value pairs)
  • therefore, added new array swiftConds to clearly distinguish from gccDefs (this also prevents similar programming mistakes in the future) and a new config variable SWIFT_CONDITIONS in project.xcconfig
  • replaced all current key-value compiler flags (see Note above)
  • additionally made some "chore":
    • changed TI_APPLICATION_DEPLOYTYPE into TI_APPLICATION_DEPLOY_TYPE to consistently take camel case into account (comp. with deployType)
    • changed templated value __APP_DEPLOY_TYPE__ (=buildType) into __BUILD_TYPE__ to avoid confusion with __DEPLOY_TYPE__ (=deployType)

@hbugdoll hbugdoll mentioned this pull request Nov 28, 2025
31 tasks
@socket-security
Copy link

socket-security bot commented Nov 28, 2025

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report

@hbugdoll
Copy link
Contributor Author

hbugdoll commented Nov 28, 2025

Changes from initial draft:

  • replaced undocumented SWIFT_COMPILER_FLAGS with OTHER_SWIFT_FLAGS1
  • use of JS arrow functions

Footnotes

  1. https://developer.apple.com/documentation/xcode/build-settings-reference#Other-Swift-Flags

@hbugdoll hbugdoll marked this pull request as ready for review November 28, 2025 08:12
@hbugdoll hbugdoll marked this pull request as draft November 28, 2025 12:39
@hbugdoll
Copy link
Contributor Author

New changes:

  • rework: replaced key-value compiler flags overall

@hbugdoll hbugdoll marked this pull request as ready for review December 10, 2025 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant