Jenkins 搭建U3D自動發佈 IOS

http://www.cnblogs.com/yinghuochong/archive/2013/09/01/3294940.html html

1.安裝包,工具略過。python

2.插件管理 git

 

This plugin adds the Subversion support (via SVNKit) to Jenkins.
This plugin will upload .ipa or .apk file(s) to  testflightapp.com for distribution.
This plugin provides builders to build xcode projects, invoke agvtool and package .ipa files
This plug-in adds reusable macro expansion capability for other plug-ins to use.
This plugin provides a new enhanced API for interacting with SCM systems.
Integrates Jenkins with CVS version control system using a modified version of the Netbeans cvsclient.
This plugin integrates  GIT with Jenkins.
 
3.新建項目開始配置步驟:

1>.源碼管理 :SVN更新代碼工程與資源 。xcode

2>.構建觸發器,能夠不要 指定時間本身構建  Poll SCM  H 22 * * *  【天天22.00點自動構建一次】app

3>.添加Execute Shell 步驟less

cp $WORKSPACE/Tools/PostProcessBuildPlayer $WORKSPACE/code/Assets/Editor/
chmod +x $WORKSPACE/code/Assets/Editor/PostProcessBuildPlayeride

rm -rf $WORKSPACE/build
mkdir -p $WORKSPACE/buildsvn

echo Start building Unity project to iOS project..........
/Applications/Unity/Unity.app/Contents/MacOS/Unity -projectPath $WORKSPACE/code -executeMethod PerformBuild.CommandLineBuild -batchmode -quit -logFile $WORKSPACE/build/log.txt工具

echo Copy resource to build directory.....
mkdir -p ${WORKSPACE}/build/iPhone/Data/ClientRes
cp -r ${WORKSPACE}/ClientRes/Config ${WORKSPACE}/build/iPhone/Data/ClientRes
cp -r ${WORKSPACE}/ClientRes/Assetbundles_Ios ${WORKSPACE}/build/iPhone/Data/ClientRes
rm -rf ${WORKSPACE}/build/iPhone/Data/ClientRes/Config/.svn
rm -rf ${WORKSPACE}/build/iPhone/Data/ClientRes/Assetbundles_Ios/.svnui

python $WORKSPACE/Tools/updateInfo.py ${WORKSPACE}/build/iPhone 0.6 ${BUILD_NUMBER}

4>.Xcode 工程導出IPA。

5.

cd ${WORKSPACE}/build/distributes
mkdir -p DragonBone-0.6.${BUILD_NUMBER}
cp *.ipa DragonBone-0.6.${BUILD_NUMBER}\

# Generate .plist file for wireless app distribution
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>__URL__</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>com.cdkoi.dragon</string>
<key>bundle-version</key>
<string>dragon 0.6.${BUILD_NUMBER}</string>
<key>kind</key>
<string>software</string>
<key>title</key>
<string>Dragon Bone for iOS</string>
<key>subtitle</key>
<string>0.6.${BUILD_NUMBER}</string>
</dict>
</dict>
</array>
</dict>
</plist>" > "${WORKSPACE}/build/distributes/DragonBone-0.6.${BUILD_NUMBER}/app.plist";
cp -r ${WORKSPACE}/build/distributes/DragonBone-0.6.${BUILD_NUMBER} ~/distributes

 ===========updateInfo.py 內容===========

# -*- coding: utf-8 -*-
#!/usr/bin/python

import sys
import os

PRDUCT_NAME = "XXX"
CBundleIdentifier = "com.cdkoi.dragon"

def process_info(info_filename, product_name, bundle_version, build_version):
info_plist = open( info_filename, 'r' )
lines = info_plist.readlines()
info_plist.close()

info_plist = open( info_filename, 'w' )

# Now iterate through the project adding any new lines where needed
i = 0
stepOneLine = False
for i in range(0, len(lines)):
if stepOneLine == False:
line = lines[i]
info_plist.write(line)
stepOneLine = False

if line.strip() == "<key>CFBundleName</key>":
info_plist.write( "\t" + "<string>" + PRDUCT_NAME + "</string>" + '\n' )
stepOneLine = True

if line.strip() == "<key>CFBundleDisplayName</key>":
info_plist.write( "\t" + "<string>" + PRDUCT_NAME + "</string>" + '\n' )
stepOneLine = True

if line == '<key>CFBundleShortVersionString</key>':
info_plist.write( "<string>1.0</string>" + '\n' )
stepOneLine = True

if line == '<key>CFBundleVersion</key>':
info_plist.write( "<string>1.0</string>" + '\n' )
stepOneLine = True
else:
stepOneLine = False

info_plist.close()


# Script start
print "Starting Modify info.plist with the following arguments..."

i = 0
for args in sys.argv:
print str(i) +': ' + args
i += 1

# Check this is an iOS build before running
if len(sys.argv) == 4:

info_full_path_name = sys.argv[1] + '/info.plist' process_info(info_full_path_name, "龍之骨", "1.0", "1.0")

相關文章
相關標籤/搜索