0

我安装了一个 Jenkins 并使用 Git 插件、Xcode 插件和 Testflight 插件启动了一个项目。

我可以使用设置创建自动构建,但是在为 Testflight 创建 .ipa 文件时失败了。

问题在于调试和发布设置以不同的方式...</p>

如果我尝试通过 Debug 设置创建 .ipa,它将在没有 build/Debug-iphoneos 文件夹的情况下失败(我尝试关闭 clean 选项,但没有帮助)。但是 Xcode Build 在命令行上没有失败

当我尝试切换到 Release 时,链接器失败(ld)。

没有 .ipa 文件,我无法提交给 Testflight 并获得自动测试分发。

4

2 回答 2

2

这是我正在使用的脚本。(显然我删除了个人信息,但您应该可以理解)。

TARGET_NAME="-"     # Target name
TARGET_SDK="iphoneos"                   # Target SDK: iphoneos
CONFIGURATION="Release"     # Build Configuration
BUILD_DIR="build"                       # Directory where the build is generated
ARCHS="armv7"                           # Valid Architectures
APP_NAME="-"                # Application name

## Provisioning configurations
BUILD_ARCHIVED_DIR="BuildArchived"                  # Directory with the history of builds
DEVELOPER_NAME="-"  # Developer name
PROVISIONING_PROFILE=Prototype.mobileprovision      # Provisioning profile file
PROVISIONING_DIR=~/Library/MobileDevice/Provisioning\ Profiles/                     # Provisioning dir

## TestFlight App
TESTFLIGHT_API_TOKEN="-"    
TESTFLIGHT_TEAM_TOKEN="-"


#Release Notes
BUILDSCRIPTS_DIR="build"
TESTFLIGHT_RELEASE_NOTES_FILE="ios_testflight-releasenotes"


#Distribution Lists
TESTFLIGHT_DISTRIBUTION_LISTS="Jenkins"


# Returns to the root directory of the build
cd ../ios

PROJECT_BUILDDIR="${BUILD_DIR}/${CONFIGURATION}-${TARGET_SDK}"
CURRENT_DIR=`pwd`

# fix for the newest sdk
# Only export the environment variable if the location exists,
# otherwise it breaks the signing process!
if [ -f "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate" ]
then
  echo Export environment variable for codesign_allocate location
  export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
fi


#changing the build version
INFO_PLIST_PATH="${CURRENT_DIR}/${TARGET_NAME}/${TARGET_NAME}-Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${SVN_REVISION}" $INFO_PLIST_PATH


# compile project
echo Building Project
xcodebuild -target "${TARGET_NAME}" -sdk "${TARGET_SDK}" ARCHS=${ARCHS} -configuration "${CONFIGURATION}" clean build

#Check if build succeeded
#if [ $? != 0 ]
#then
#  exit 1
#fi

# Create output dir ($x) if doesn't exist
mkdir -p $BUILD_ARCHIVED_DIR

# .ipa file generation
echo Generating .ipa file 
/usr/bin/xcrun -sdk "${TARGET_SDK}" PackageApplication -v     "${PROJECT_BUILDDIR}/${APP_NAME}.app" -o     "${CURRENT_DIR}/${BUILD_ARCHIVED_DIR}/${APP_NAME}.ipa" --sign "${DEVELOPER_NAME}" 

#zipping the .dSYM to send to Testflight
echo Generating zip file
/usr/bin/zip -r "${CURRENT_DIR}/${BUILD_ARCHIVED_DIR}/${APP_NAME}.app.dSYM.zip" "${CURRENT_DIR}/${PROJECT_BUILDDIR}/${APP_NAME}.app.dSYM"

echo Sending to TestFlight
curl http://testflightapp.com/api/builds.json -F file="@${CURRENT_DIR}/${BUILD_ARCHIVED_DIR}/${APP_NAME}.ipa" -F dsym="@${CURRENT_DIR}/${BUILD_ARCHIVED_DIR}/${APP_NAME}.app.dSYM.zip" -F api_token="${TESTFLIGHT_API_TOKEN}" -F team_token="${TESTFLIGHT_TEAM_TOKEN}" -F notes="This build was uploaded via the upload API" -F notify=False -F distribution_lists="${TESTFLIGHT_DISTRIBUTION_LISTS}" 
echo Submission ended
于 2013-05-28T18:01:41.063 回答
0

我想您的构建所针对的方案不正确。

此外,TestFlight有一个Jenkins 插件,因此您可以编写构建过程的脚本并使用他们的 Jenkins 插件执行上传到 TestFlight。我提供了一个构建脚本示例,它通过手动命令行和Jenkins CI对我有用。

如果您想查看完整设置,可以在此处找到iOS/Git/TestFlight教程:Jenkins iOS – Git、xcodebuild、TestFlight

xcodebuild -alltargets clean

rm -rf "./JenkinsBuild/*"

xcodebuild -target HelloJenkins PROVISIONING_PROFILE="00000000-0000-0000-0000-000000000000" CONFIGURATION_BUILD_DIR=JenkinsBuild

rm -rf "./JenkinsArchive/*"

xcodebuild -scheme HelloJenkins archive PROVISIONING_PROFILE="00000000-0000-0000-0000-000000000000" CODE_SIGN_IDENTITY="iPhone Developer: Jonny Appleseed (XXXXXXXXXX)" -archivePath ./JenkinsArchive/HelloJenkins.xcarchive

rm -rf "./JenkinsIPAExport/*"

xcodebuild -exportArchive -exportFormat IPA -exportProvisioningProfile iOS\ Team\ Provisioning\ Profile:\ com.yourAPP.HelloJenkins -archivePath ./JenkinsArchive/HelloJenkins.xcarchive -exportPath ./JenkinsIPAExport/HelloJenkins.ipa
于 2014-01-28T14:16:36.213 回答