Upgrade to Pro — share decks privately, control downloads, hide ads and more …

论 Mobile App (iOS/Android)自动化构建是如何炼成的

icyleaf
December 15, 2014

论 Mobile App (iOS/Android)自动化构建是如何炼成的

如果更加自由的打包 Android/iOS App,今天咱就说说看。
更新:支持国内代理安装 android sdk

icyleaf

December 15, 2014
Tweet

More Decks by icyleaf

Other Decks in Technology

Transcript

  1. ⼤大纲 • Jenkins 介绍 • 安装 Jenkins • Android App

    ⾃自动化构建 • iOS App ⾃自动化构建
  2. Jenkins • 开源项⺫⽬目 • 市⾯面上使⽤用最⼲⼴广泛的 CI 系统 • ⽀支持所有平台(基于 Java

    发布) • 极其丰富的插件库(300+) • 背后有众多商业公司的⽀支持
  3. 通知 pull & push fir & pgyer fir & pgyer

    push pull 编译&打包 测试&发布
  4. 安装 Jenkins • CentOS: yum install jenkins • Ubuntu: apt-get

    install jenkins • OS X: brew install jenkins • 更多的安装教程
  5. 安装 android sdk • 安装必要 sdk android update sdk -u

    --all --filter \ tools,\ platform-tools,\ build-tools-20.0.0,\ android-21 • 安装⾃自定义依赖 android update sdk -u --all --filter \ extra-android-m2repository,\ extra-android-support,\ extra-google-google_play_services_froyo,\ extra-google-google_play_services,\ extra-google-m2repository
  6. android sdk 失败了! • 改 hosts 203.208.46.146 www.google.com 203.208.46.146 dl.google.com

    203.208.46.146 dl-ssl.google.com • 执⾏行命令强⾏行不⾛走 https android update sdk -u -s --filter platform-tools,android-21
  7. gradle 解答 • gradle 是扩展 maven/ant 的增强构建⽅方案 • gralde android

    插件版本依赖 gradle 命令版本 • gradle 可以集成多个模块(本地/⺴⽹网络) • gradle ⽀支持 Java/Groovy 的内容扩展 • gradle 中⽂文指南(⺩王伟提供) • 使⽤用 wrapper ⽀支持各种版本
  8. 配置 Jenkins • 安装插件 • gradle • android Lint •

    javadoc • ruby-runtime • 配置全局环境
  9. 配置 Jenkins • Jenkins Slave(可选) • 安装插件 • xcode integration

    • cocoapods jenkins • iOS device connector • 配置全局环境
  10. xcodebuild by apple // unlock keychain security unlock-keychain -p {password}

    ~/Library/Keychains/login.keychain // clean and build .app for project xcodebuild clean build -project QYER.xcodeproj -configuration Release // build .app for workspace xcodebuild clean build -workspace QYER.xcworkspace -scheme QYER -configuration AdHoc // code sign and archive ipa file xcrun -sdk iphoneos PackageApplication -v ~/Desktop/QYER.app -o ~/Desktop/QYER.ipa --sign "iPhone Distribution: <QYER Inc>" --embed ~/Downloads/QYER_Ad_Hoc.mobileprovision
  11. xctool by facebook // unlock keychain security unlock-keychain -p {password}

    ~/Library/Keychains/login.keychain // clean and build .app for project xctool clean build -project QYER.xcodeproj -configuration Release // build .app for workspace xctool clean build -workspace QYER.xcworkspace -scheme QYER -configuration AdHoc // code sign and archive ipa file xcrun -sdk iphoneos PackageApplication -v ~/Desktop/QYER.app -o ~/Desktop/QYER.ipa --sign "iPhone Distribution: <QYER Inc>" --embed ~/Downloads/QYER_Ad_Hoc.mobileprovision
  12. Shenzhen by nomad // unlock keychain security unlock-keychain -p {password}

    ~/Library/Keychains/login.keychain // clean and build code sign .ipa for project ipa build -p QYER.xcodeproj -c Release —clean // just build code sign .ipa for workspace ipa build -w QYER.xcworkspace -s QYER -c AdHoc —no-clean // distribute .ipa to somewhere (10 channels) ipa distribute:fir ipa distribute:itunesconnect
  13. 参考资料 • Android • Building Gradle Projects with Jenkins CI

    • How To Build Android Apps with Jenkins • iOS • How to configure Jenkins CI on Mac OS X to build Android- and iOS • Applying Continuous Deployment to iOS • IOS AND JENKINS: HOW WE USE IT
  14. Q&A