简体   繁体   English

Xcode共享运行脚本在工作区中的项目之间构建阶段

[英]Xcode share run script build phase between projects in a workspace

Is there a way in Xcode to share a run script build phase across multiple projects in a workspace? Xcode中有没有办法在工作区中的多个项目之间共享运行脚本构建阶段?

I am using SwiftLint to enforce coding styles, but I don't want to manually add the necessary run script to all of the projects (that I maintain, not 3rd party) in my Xcode project. 我使用SwiftLint来强制执行编码样式,但我不想在我的Xcode项目中手动将必要的运行脚本添加到所有项目(我维护,而不是第三方)。

I found a solution, but it is a solution specific to SwiftLint, not any run script. 我找到了一个解决方案,但它是特定于SwiftLint的解决方案,而不是任何运行脚本。

My solution that seems to work fine is to pick whichever target I will normally be building and only put the run script for that target, but make the run script specify the --path to be one directory up. 我的解决方案似乎工作得很好,就是选择我通常构建的目标,只为该目标设置运行脚本,但是让运行脚本指定--path为一个目录。 Since SwiftLint runs recursively in all subdirectories this works fine: 由于SwiftLint在所有子目录中递归运行,因此工作正常:

swiftlint lint --path "$SRCROOT"/..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM