当前位置:   article > 正文

在OsX系统上使用Jenkins自动构建发布Unity3d的iOS版本到fir.im

在osx系统上使用jenkins自动构建发布unity3d的ios

一、在OsX系统上安装Jenkins

二、打开终端,安装XCode的命令行工具

xcode-select --install

三、添加xcodeproj和fir-cli工具

gem install xcodeproj
gem install fir-cli

四、在~目录中新建一个Unity.rb文件,内容是需要对导出的iOS工程进行修改的脚本,其中

releaseTarget.frameworks_build_phase.add_file_reference 为添加链接库,内容如下:

  1. require 'xcodeproj'
  2. project = Xcodeproj::Project.open("Unity-iPhone.xcodeproj");
  3. targets = project.native_targets();
  4. releaseTarget = targets[0];
  5. usrLibPath="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/usr/lib/";
  6. libs = ["libstdc++.tbd", "libstdc++.6.0.9.tbd", "libz.1.2.5.tbd"];
  7. libs.each do |name|
  8. r = project.frameworks_group.new_file(usrLibPath+name, :sdk_root);
  9. releaseTarget.frameworks_build_phase.add_file_reference(r, true);
  10. end
  11. sysPath="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/";
  12. syslibs=["Security.framework",
  13. "AVFoundation.framework",
  14. "SystemConfiguration.framework",
  15. "AudioToolbox.framework",
  16. "CoreLocation.framework",
  17. "AddressBook.framework",
  18. "CoreTelephony.framework"];
  19. syslibs.each do |name|
  20. project.frameworks_group.new_file(sysPath+name, :sdk_root);
  21. end
  22. project.save();

五、在Jenkins中添加Unity3d的构建

currtime=`date "+%Y%m%d_%H.%M.%S"`
/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -projectPath /User/myproj -logFile /tmp/1.log -executeMethod MyBuild.BuildIOS ${currtime}

如果MyBuild.BuildIOS构建成功,则把iOS工程导出到当前一个新的目录${currtime}

六、运行 ruby unity.rb, 对XCode工程进行修改

七、运行XCode命令行工具Archive及Export ipa

xcodebuild clean -project ./Unity-iPhone.xcodeproj -configuration Release -alltargets
xcodebuild archive -project ./Unity-iPhone.xcodeproj -scheme Unity-iPhone -archivePath ./build_output/Unity-iPhone.xcarchive
xcodebuild -exportArchive -archivePath ./build_output/Unity-iPhone.xcarchive -exportPath ./build_output/Unity-iPhone -exportFormat ipa -exportProvisioningProfile "XCAd Hoc: com.my.game"

八、上传fir.im

fir login --token=XXXXXXXX

fir publish ./Unity-iPhone.ipa

其中XXXX为fir.im API Token


声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/112046
推荐阅读
相关标签
  

闽ICP备14008679号