一个封装了 xcodebuild
, agvtool
, 和其他 xcrun
工具的封装器,构建于 Sh 之上。
完整的示例应用,请参阅 https://github.com/FullQueueDeveloper/SwishExampleiOSProject
dependendies: [
.package(url: "https://github.com/FullQueueDeveloper/ShXcrun.git", from: "0.1.0")
]
创建一个 Xcodebuild
对象,包含你需要的参数,例如 Xcodebuild(scheme: "MySceme")
,然后调用它的一个方法。
try Xcodebuild(scheme: "MySceme").test(.terminal)
将输出发送到日志文件
try Xcodebuild(scheme: "MySceme").test(.file("logs/test.log"))
创建一个 ExportOptionsPlist
并调用 write
方法将其保存到磁盘上的路径。exportArchive
需要此路径。
也许你的脚本看起来像这样。
let exportOptionsPath = "/tmp/exportOptions.plist"
let plist = ExportOptionsPlist(distributionBundleIdentifier: "com.example.App")
try plist.write(to: exportOptionsPath)
let xcodeBuild = Xcodebuild(scheme: "MyScheme")
try xcodeBuild.archive(.file("logs/archive.log"), path: "products")
try xcodeBuild.exportArchive(.file("log/exportArchive.log"), archivePath: "products", exportPath: "products", exportOptionsPlistPath: exportOptionsPath)