13
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

fastlane 実行中に、チームやスキーマ(ビルドターゲット) を対話的に聞かれないようにする

Last updated at Posted at 2015-12-27

iOS, Mac などのアプリ開発で

  • 1つの Apple デベロッパーアカウントが複数のチームに所属している時
  • 1つのプロジェクトで、複数のターゲットをビルドする時
    (例: mac と iOS, 無料版と有料版 でターゲットを分けてる時など)

などのケースで、fastlane を使っている場合、レーン実行中に所属チームやビルドターゲット(スキーマ)を聞かれたりします。

その場合、レーンのコマンドにオプションを入れてやると聞かれなくなります。

( fastlane の起動オプションでも指定できるんでしょうかね? 未確認)

ケース1: sigh 中にチームを聞かれる

fastlane の sigh 中に、

Starting login with user 'xxxx@example.com'
Multiple teams found, please enter the number of the team you want to use:
1) XXXXXXXXXXX "Your name" (Individual)
2) YYYYYYYYYYY "Your company" (Company/Organization)

みたいに聞かれる時。

    sigh(
      team_id: "XXXXXXXXXXX",
    )

と、sigh のオプションで team_id を与えてやれば聞かれなくなります。

名前の方ではなく、左に書かれている乱数のような ID を指定します。

ケース2: snapshot, gym 中にビルドターゲット(スキーマ)を聞かれる

Installing provisioning profile...
[20:49:14]: xcrun xcodebuild -list -project ‘./YourProject.xcodeproj'
Select Scheme:
1. SchemeMacApp
2. SchemeIOSFree
3. SchemeIOS

のように聞かれる時。

snapshot(
  scheme: "SchemeIOSFree",
)

gym(
  scheme: "SchemeIOSFree",
)

のように、scheme オプションを入れると良いです。

オプションの調べ方

公式 github の README

github https://github.com/fastlane/ から、各ツールのリンク先に行くと

(sighの場合 https://github.com/fastlane/sigh )

オプションの説明が書いてありますが、抜粋して書かれているようなので全て説明されているわけではないようです。

コマンドラインツールで --help

一覧性が高く、オプションも網羅されているようです。

まず、各コマンドのコマンドラインツールが入っているか調べます。

ターミナルで

$ sigh<tab>

とか打って、コマンドがインストールされているか調べます。

snapshot は、fastlane と一緒にパスが通るので、コマンドラインから直で呼べるようになってますが、
sigh は実行できませんでした。おそらく、コマンドラインツールでインストールされてるけどパスが通ってない状態のような気がしますので、パスを通すか絶対パスで起動すればいけそうな気がするのですが、調べるのがめんどかったので

$ sudo gem install sigh

でインストールしてしまいました。

追記: Mac OS を、El Capitan へアップデートした際にパスが切れたような気がします。もしかしたら、キレイに fastlane をインストールした場合、それぞれのコマンドがそのまま実行できるこかもしれません。

で、--help をつけて起動するとオプションが表示されます。

sigh

$ sigh --help
  sigh

  CLI for 'sigh' - Because you would rather spend your time building stuff than fighting provisioning

  Commands:
    download_all Downloads all valid provisioning profiles
    help         Display global or [command] help documentation
...省略...

  Global Options:
    --verbose
    --adhoc              Setting this flag will generate AdHoc profiles instead of App Store Profiles (SIGH_AD_HOC)
    --skip_install       By default, the certificate will be added on your local machine. Setting this flag will skip this
action (SIGH_SKIP_INSTALL)
    --development        Renew the development certificate instead of the production one (SIGH_DEVELOPMENT)
    --force              Renew provisioning profiles regardless of its state - to automatically add all devices for ad hoc
profiles (SIGH_FORCE)
    -a, --app_identifier STRING The bundle identifier of your app (SIGH_APP_IDENTIFIER)
    -u, --username STRING Your Apple ID Username (SIGH_USERNAME)
    -b, --team_id STRING The ID of your team if you're in multiple teams (SIGH_TEAM_ID)
    -l, --team_name STRING The name of your team if you're in multiple teams (SIGH_TEAM_NAME)
    -n, --provisioning_name STRING The name of the profile that is used on the Apple Developer Portal
(SIGH_PROVISIONING_PROFILE_NAME)
    --ignore_profiles_with_different_name  Use in combination with :provisioning_name - when true only profiles matching this
exact name will be downloaded (SIGH_IGNORE_PROFILES_WITH_DIFFERENT_NAME)
    -o, --output_path STRING Directory in which the profile should be stored (SIGH_OUTPUT_PATH)
    -i, --cert_id STRING The ID of the code signing certificate to use (e.g. 78ADL6LVAA)  (SIGH_CERTIFICATE_ID)
    -c, --cert_owner_name STRING The certificate name to use for new profiles, or to renew with. (e.g. "Felix Krause")
(SIGH_CERTIFICATE)
    -q, --filename STRING Filename to use for the generated provisioning profile (must include .mobileprovision)
(SIGH_PROFILE_FILE_NAME)
    -w, --skip_fetch_profiles  Skips the verification of existing profiles which is useful if you have thousands of profiles
(SIGH_SKIP_FETCH_PROFILES)
    -z, --skip_certificate_verification  Skips the verification of the certificates for every existing profiles. This will
make sure the provisioning profile can be used on the local machine (SIGH_SKIP_CERTIFICATE_VERIFICATION)
    -h, --help           Display help documentation
    -v, --version        Display version information ```

fastlane内でオプションを指定する場合、このヘルプのロングオプション名を参考にすると良いと思います。

sigh なら、 team_id や team_name が使えそうですね。

ついでに gym, snapshot のオプション

gym

  gym
  ... 省略 ...
  Global Options:
    -w, --workspace STRING Path the workspace file (GYM_WORKSPACE)
    -p, --project STRING Path the project file (GYM_PROJECT)
    -s, --scheme STRING  The project's scheme. Make sure it's marked as `Shared` (GYM_SCHEME)
    -c, --clean          Should the project be cleaned before building it? (GYM_CLEAN)
    -o, --output_directory STRING The directory in which the ipa file should be stored in (GYM_OUTPUT_DIRECTORY)
    -n, --output_name STRING The name of the resulting ipa file (GYM_OUTPUT_NAME)
    -q, --configuration STRING The configuration to use when building the app. Defaults to 'Release' (GYM_CONFIGURATION)
    -a, --silent         Hide all information that's not necessary while building (GYM_SILENT)
    -i, --codesigning_identity STRING The name of the code signing identity to use. It has to match the name exactly. e.g.
'iPhone Distribution: SunApps GmbH' (GYM_CODE_SIGNING_IDENTITY)
    -m, --include_symbols  Should the ipa file include symbols? (GYM_INCLUDE_SYMBOLS)
    -z, --include_bitcode  Should the ipa include bitcode? (GYM_INCLUDE_BITCODE)
    --use_legacy_build_api  Don't use the new API because of https://openradar.appspot.com/radar?id=4952000420642816
(GYM_USE_LEGACY_BUILD_API)
    -j, --export_method STRING How should gym export the archive? (GYM_EXPORT_METHOD)
    -b, --archive_path STRING The directory in which the archive file should be stored in (GYM_ARCHIVE_PATH)
    -l, --buildlog_path STRING The directory where to store the build log (GYM_BUILDLOG_PATH)
    -k, --sdk STRING     The SDK that should be used for building the application (GYM_SDK)
    -e, --provisioning_profile_path STRING The path to the provisioning profile (optional) (GYM_PROVISIONING_PROFILE_PATH)
    -d, --destination STRING Use a custom destination for building the app (GYM_DESTINATION)
    -g, --export_team_id STRING Optional: Sometimes you need to specify a team id when exporting the ipa file
(GYM_EXPORT_TEAM_ID)
    -x, --xcargs STRING  Pass additional arguments to xcodebuild. Be sure to quote the setting names and values e.g.
OTHER_LDFLAGS="-ObjC -lstdc++" (GYM_XCARGS)
    -y, --xcconfig STRING Use an extra XCCONFIG file to build your app (GYM_XCCONFIG)
    -r, --suppress_xcode_output  Suppress the output of xcodebuild to stdout. Output is still saved in buildlog_path
(SUPPRESS_OUTPUT)
    --verbose
    -h, --help           Display help documentation
    -v, --version        Display version information

snapshot

  snapshot

  ... 省略 ...
  Global Options:
    --verbose            Shows a more verbose output
    -w, --workspace STRING Path the workspace file (SNAPSHOT_WORKSPACE)
    -p, --project STRING Path the project file (SNAPSHOT_PROJECT)
    --devices            A list of devices you want to take the screenshots from
    --languages          A list of languages which should be used
    --launch_arguments   A list of launch arguments which should be used (SNAPSHOT_LAUNCH_ARGUMENTS)
    -o, --output_directory STRING The directory where to store the screenshots (SNAPSHOT_OUTPUT_DIRECTORY)
    --ios_version STRING By default, the latest version should be used automatically. If you want to change it, do it here
    --stop_after_first_error  Should snapshot stop immediately after one of the tests failed on one device?
(SNAPSHOT_BREAK_ON_FIRST_ERROR)
    --skip_open_summary  Don't open the HTML summary after running `snapshot` (SNAPSHOT_SKIP_OPEN_SUMMARY)
    --clear_previous_screenshots  Enabling this option will automatically clear previously generated screenshots before
running snapshot (SNAPSHOT_CLEAR_PREVIOUS_SCREENSHOTS)
    --reinstall_app      Enabling this option will automatically uninstall the application before running it
(SNAPSHOT_REINSTALL_APP)
    -a, --app_identifier STRING The bundle identifier of the app to uninstall (only needed when enabling reinstall_app)
(SNAPSHOT_APP_IDENTIFIER)
    -l, --buildlog_path STRING The directory where to store the build log (SNAPSHOT_BUILDLOG_PATH)
    -c, --clean          Should the project be cleaned before building it? (SNAPSHOT_CLEAN)
    -q, --configuration STRING The configuration to use when building the app. Defaults to 'Release' (SNAPSHOT_CONFIGURATION)

    -k, --sdk STRING     The SDK that should be used for building the application (SNAPSHOT_SDK)
    -s, --scheme STRING  The scheme you want to use, this must be the scheme for the UI Tests (SNAPSHOT_SCHEME)
    -h, --help           Display help documentation
    -v, --version        Display version information

あとは、ソース読むことになるんでしょうかね。

13
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?