user icon

Fastlaneの基本 〜gym入れてみる〜

Fastlaneファイルの基本構造を確認したところで、
次にパッケージを1つ動かしてみようと思います
gymを入れてみました。ipaファイルを作るパッケージです
sudo gem install gymでインストールします

test:FastlaneTest test$ gym --workspace "FastlaneTest.xcodeproj/project.xcworkspace" --scheme "FastlaneTest" --clean --use_legacy_build_api
[11:38:10]: Using legacy build system - waiting for radar to be fixed: https://openradar.appspot.com/radar?id=4952000420642816
[11:38:10]: xcrun xcodebuild -list -workspace 'FastlaneTest.xcodeproj/project.xcworkspace'

+----------------------+--------------------------------------------+
|                       Summary for gym 1.6.2                       |
+----------------------+--------------------------------------------+
| workspace            | FastlaneTest.xcodeproj/project.xcworkspace |
| scheme               | FastlaneTest                               |
| clean                | true                                       |
| use_legacy_build_api | true                                       |
| destination          | generic/platform=iOS                       |
| output_name          | FastlaneTest                               |
| output_directory     | .                                          |
| silent               | false                                      |
| buildlog_path        | ~/Library/Logs/gym                         |
+----------------------+--------------------------------------------+

〜中略〜

[11:38:34]: Successfully exported and compressed dSYM file
[11:38:34]: Successfully exported and signed the ipa file:
[11:38:34]: /Users/test/WorkSpace/test/FastlaneTest/FastlaneTest.ipa

スクリーンショット 2016-04-27 14.17.04

ipaファイルができていることが確認できます!
—use_legacy_build_api をパラメータに入れていないと
“The operation couldn’t be completed. (IDEDistributionErrorDomain error 1.)”
というエラーが発生するようです(参考:http://qiita.com/takecian/items/6d34448d61c69e0d4a7f)
以上を確認した上で、最初に作ったFastlaneファイルにgymを入れてみます

  1 fastlane_version "1.81.0"
  2 default_platform :ios
  3
  4 platform :ios do
  5   before_all do
  6     say ["before all"]
  7   end
  8
  9   desc "テストですよー"
 10   lane :test do
 11     gym(
 12     workspace: "FastlaneTest.xcodeproj/project.xcworkspace",
 13     scheme: "FastlaneTest",
 14     clean: true,
 15     use_legacy_build_api: true
 16     )
 17   end
 18
 19   desc "テストですよー2"
 20   lane :test2 do |options|
 21     say [options[:hoge]]
 22   end
 23
 24   after_all do |lane|
 25     say ["after all"]
 26   end
 27
 28   error do |lane, exception|
 29     say ["エラー"]
 30   end
 31 end

ipaファイルを消して実行

test:fastlane test$ fastlane test
[14:29:08]: -------------------------------------------------
[14:29:08]: --- Step: Verifying required fastlane version ---
[14:29:08]: -------------------------------------------------
[14:29:08]: fastlane version valid
[14:29:08]: ------------------------------
[14:29:08]: --- Step: default_platform ---
[14:29:08]: ------------------------------
[14:29:08]: Driving the lane 'ios test' 🚀
[14:29:08]: -----------------
[14:29:08]: --- Step: say ---
[14:29:08]: -----------------
[14:29:08]: $ say 'before all'
[14:29:10]: -----------------
[14:29:10]: --- Step: gym ---
[14:29:10]: -----------------
[14:29:10]: Using legacy build system - waiting for radar to be fixed: https://openradar.appspot.com/radar?id=4952000420642816
[14:29:10]: xcrun xcodebuild -list -workspace 'FastlaneTest.xcodeproj/project.xcworkspace'

+----------------------+--------------------------------------------+
|                       Summary for gym 1.6.2                       |
+----------------------+--------------------------------------------+
| workspace            | FastlaneTest.xcodeproj/project.xcworkspace |
| scheme               | FastlaneTest                               |
| clean                | true                                       |
| use_legacy_build_api | true                                       |
| destination          | generic/platform=iOS                       |
| output_name          | FastlaneTest                               |
| output_directory     | .                                          |
| silent               | false                                      |
| buildlog_path        | ~/Library/Logs/gym                         |
+----------------------+--------------------------------------------+

〜中略〜

[14:29:45]: Successfully exported and compressed dSYM file
[14:29:45]: Successfully exported and signed the ipa file:
[14:29:45]: /Users/test/WorkSpace/test/FastlaneTest/FastlaneTest.ipa
[14:29:45]: -----------------
[14:29:45]: --- Step: say ---
[14:29:45]: -----------------
[14:29:45]: $ say 'after all'

+------+-------------------------------------+-------------+
|                     fastlane summary                     |
+------+-------------------------------------+-------------+
| Step | Action                              | Time (in s) |
+------+-------------------------------------+-------------+
| 1    | Verifying required fastlane version | 0           |
| 2    | default_platform                    | 0           |
| 3    | say                                 | 1           |
| 4    | gym                                 | 35          |
| 5    | say                                 | 1           |
+------+-------------------------------------+-------------+

[14:29:46]: fastlane.tools finished successfully 🎉

スクリーンショット 2016-04-28 14.48.52

スクリーンショット 2016-04-28 11.48.50
例えば、FastlaneTestスキーマをコピーしたFastlane2も

 10   lane :test do
 11     gym(
 12     workspace: "FastlaneTest.xcodeproj/project.xcworkspace",
 13     scheme: "FastlaneTest2",
 14     clean: true,
 15     use_legacy_build_api: true
 16     )

とschemeの値を編集すれば同じようにipaファイルが作成されます

次はリリースまでの一通りのパッケージを入れた状態のFastlaneファイルを用意してみようかと思います

Facebooktwitterlinkedintumblrmail

Tags: ,

名前
E-mail
URL
コメント

日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)