Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do we add swift compile flag to `gym` when using fastlane

Tags:

fastlane

There are not much documentation about this here in the office documentation page https://docs.fastlane.tools/actions/gym/.

The only thing that mentioned compile flag is:

xcargs:
Pass additional arguments to xcodebuild for the build phase. Be sure to quote the setting names and values e.g. OTHER_LDFLAGS="-ObjC -lstdc++"

This is what we have currently:

gym(options.merge(:export_xcargs => "-allowProvisioningUpdates", 
                  :export_method => "development"))

We would like now adding this flag to our build:

-Xfrontend -warn-long-expression-type-checking=100

We don't want to add it to Xcode project file like this https://github.com/fastred/Optimizing-Swift-Build-Times since we only want this check on the build machine which uses fastlane.

So this is what we tried:

gym(options.merge(:export_xcargs => "-allowProvisioningUpdates", 
                  :export_method => "development",
                  :xcargs => "-Xfrontend -warn-long-expression-type-checking=100"))

But it keeps complaining about this error:

xcodebuild: error: invalid option '-Xfrontend'

How do we add this flag properly?

like image 211
Yuchen Avatar asked May 10 '18 14:05

Yuchen


1 Answers

This works!

gym(options.merge(:export_xcargs => "-allowProvisioningUpdates", 
                  :export_method => "development",
                  :xcargs => "OTHER_SWIFT_FLAGS='-Xfrontend -warn-long-expression-type-checking=100'"))
like image 97
Yuchen Avatar answered Sep 19 '22 03:09

Yuchen