当使用fastlane时,我们如何向"gym"添加Swift编译标志?

7
办公室文档页面上关于这方面的文档很少,详情请参见 https://docs.fastlane.tools/actions/gym/
唯一提到编译标志的地方是:

xcargs:
为构建阶段向xcodebuild传递其他参数。请确保引用设置名称和值,例如:OTHER_LDFLAGS="-ObjC -lstdc++"

这是我们目前所拥有的内容:
gym(options.merge(:export_xcargs => "-allowProvisioningUpdates", 
                  :export_method => "development"))

我们现在希望将这个标志添加到我们的构建中:
-Xfrontend -warn-long-expression-type-checking=100

我们不想像这样将它添加到Xcode项目文件中:https://github.com/fastred/Optimizing-Swift-Build-Times ,因为我们只想在使用fastlane的构建机上进行此检查。
因此,这是我们尝试过的方法:
gym(options.merge(:export_xcargs => "-allowProvisioningUpdates", 
                  :export_method => "development",
                  :xcargs => "-Xfrontend -warn-long-expression-type-checking=100"))

但是它一直抱怨这个错误:
xcodebuild: error: invalid option '-Xfrontend'

我们如何正确添加这个标志?
2个回答

7

这个有效!

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

1
非常感谢,这是我找到的唯一一种通过环境变量将xcargs发送到xcode的解决方案之一。同样适用于GCC_PREPROCESSOR_DEFINITIONS。 - svnm

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接