首页 > 解决方案 > xcodebuild 不生成输出文件

问题描述

我已经建立了一个 CI iOS 工作流程(尝试了 BitRise 和 Travis)来构建一个 xcode框架。虽然我对 iOS 应用程序没有任何问题,但这个框架很难构建。我创建了一个 cocoapod 库(带有示例项目),现在我尝试存档该库。

我的项目有一个包含多个方案的工作区。由于我的项目使用 Vuforia,我无法在模拟器上测试我的框架/库,因为该 vuforia-library 根本不存在。

我有一个构建脚本,可以在我的机器上本地运行而不会出现任何问题:

xcodebuild archive -workspace Example/MyLib.xcworkspace -scheme "MyLib" -configuration Release -derivedDataPath ./build -archivePath ./build/Products/MyLib.xcarchive -sdk iphoneos ONLY_ACTIVE_ARCH=NO -destination generic/platform=iOS | xcpretty -c

-destination 部分至关重要,因为它阻止了为模拟器甚至 i386 平台构建。

当我在 travis 或 bitrise 上运行此脚本时,我得到以下结果:

▸ Archive Succeeded
The command "xcodebuild archive -workspace Example/MyLib.xcworkspace -scheme "MyLib" -configuration Release -derivedDataPath ./build -archivePath ./build/Products/MyLib.xcarchive -sdk iphoneos ONLY_ACTIVE_ARCH=NO -destination generic/platform=iOS | xcpretty -c" exited with 0.

当我尝试查找工件时,文件夹是空的。整个 xcodebuild 命令的构建时间为 5 秒,并且不会显示任何已编译文件的日志输出。

这是我的脚本:

# references:
# * https://www.objc.io/issues/6-build-tools/travis-ci/
# * https://github.com/supermarin/xcpretty#usage
os: osx
osx_image: xcode11.3
language: swift
# cache: cocoapods
podfile: Example/Podfile
before_install:
  - brew update
  - brew install git-lfs
  - gem install cocoapods
  - pod install --project-directory=Example
before_script:
  - git lfs pull
script:
  - xcodebuild archive -workspace Example/MyLib.xcworkspace -scheme "MyLib" -configuration Release -derivedDataPath ./build -archivePath ./build/Products/MyLib.xcarchive -sdk iphoneos ONLY_ACTIVE_ARCH=NO -destination generic/platform=iOS | xcpretty -c

我尝试过清理、构建、归档。总是一样的结果。我尝试了不同版本的 cocoapods,但没有成功。构建日志显示与控制台完全相同的输出,如上所示。更改derivedDataPath 和/或archivePath 并没有改变任何东西。

不管我做什么,输出总是空的,没有文件被编译。为什么它说“成功”但显然失败了?

谢谢你的帮助,扬

标签: ioscontinuous-integrationxcodebuild

解决方案


推荐阅读