LoginSignup
21
22

More than 5 years have passed since last update.

JenkinsでAndroid SDKを毎日自動更新しよう

Posted at

概容

ビルドしたらAndroid SDKがないなんてことがよくある。

JakeWhartonさんのsdk-manager-pluginを使えばいいじゃんって話もあるが、emulatorとかもろもろも最新にしておきたい。

そこでcron的にjobを一個登録しておくと便利だったのでメモ。

1. タスクの作成

適当にフリースタイル・プロジェクトのビルドで作成する

step1_create_job.png

2. トリガーの設定

トリガーの時間は適当に設定。
平日の早朝とかにしておくといい感じ。

step2_build_trigger.png

3. アップデートスクリプトの設定

step2_shell_script.png

スクリプトは下記のような感じ

bash
expect -c "
    set timeout -1
    spawn android update sdk --no-ui

    expect {
        \"Do you accept the license\" {
            send \"y\n\"
            exp_continue
        }
        Downloading {
            exp_continue
        }
        Installing {
            exp_continue
        }
    }
"

Do you accept the license にマッチしたら、yを送信するという単純なもの。

21
22
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
21
22