-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(ios): fixed Swift compilation conditions and flags #14352
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
Conversation
|
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. |
|
Changes from initial draft:
Footnotes |
|
New changes:
|
hansemannn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor questions!
|
@cb1kenobi For Swift compatibility the key-value compiler flag titanium-sdk/iphone/cli/commands/_build.js Line 4837 in 23c26d3
|
Introduction:
These warnings have caused confusion for several times, particularly as false positive errors ([1], [2], [3], [4], [5]):
The values of the Swift compiler variable
SWIFT_ACTIVE_COMPILATION_CONDITIONSare copied fromGCC_PREPROCESSOR_DEFINITIONSiniphone/iphone/Titanium.xcodeproj/project.pbxproj.But
SWIFT_ACTIVE_COMPILATION_CONDITIONSdoesn'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.
DEPLOYTYPEflag was no longer used at all; instead,TI_APPLICATION_DEPLOYTYPEis available.__LOG__ID__flag isnot needed because it has exactly the same value asreplaced by a conditional flagTI_APPLICATION_GUIDLOGTOFILEand a new constantTI_LOG_IDwhich is filled via templated value__LOG_ID__;instead, introduction of a conditional flagLOGTOFILEis sufficient.TI_LOG_SERVER_PORTandDEFAULT_BGCOLOR_RED/..._GREEN/..._BLUE. These four can easily be replaced as templated values inwriteMain()too, analogous to App-ID/GUID/etc.Description:
splittedtransferred non-key-value flags ofGCC_PREPROCESSOR_DEFINITIONSfor use with SwiftintotoSWIFT_ACTIVE_COMPILATION_CONDITIONS(conditional compilation flags)andOTHER_SWIFT_FLAGS(key-value pairs)swiftCondsto clearly distinguish fromgccDefs(this also prevents similar programming mistakes in the future) and a new config variableSWIFT_CONDITIONSinproject.xcconfigTI_APPLICATION_DEPLOYTYPEintoTI_APPLICATION_DEPLOY_TYPEto consistently take camel case into account (comp. withdeployType)__APP_DEPLOY_TYPE__(=buildType) into__BUILD_TYPE__to avoid confusion with__DEPLOY_TYPE__(=deployType)