Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
[potatotips #70] license-list-pluginを使ってOSSライセンス画面を自動生成する / license-list-plugin
Search
syarihu
July 10, 2020
Technology
4
4.1k
[potatotips #70] license-list-pluginを使ってOSSライセンス画面を自動生成する / license-list-plugin
オンライン開催されたpotatotips #70で発表した資料です。
https://potatotips.connpass.com/event/178565/
syarihu
July 10, 2020
Tweet
Share
More Decks by syarihu
See All by syarihu
[shibuya.apk #41] Jetpack Composeでグリッドに柔軟にスペースを入れたい
syarihu
0
1.5k
[DroidKaigi 2022] 詳解Google Playの新しい定期購入 ~オファーの活用や実装例を添えて~
syarihu
0
2.5k
5分で分かるGoogle Playの新しいサブスクリプション / Google Play new subscription 2022
syarihu
1
1.5k
[DroidKaigi 2021] Google Play 定期購入 比例配分モード完全攻略ガイド / Google Play Subscription Proration Mode Complete Guide
syarihu
1
6.7k
[Money Forward Tech Drive] What's new in Google Play [Recap #io21]
syarihu
0
470
[Android 11 Meetups] Google Play Commerce からのアップデート / Android 11 Meetups Google Play Commerce
syarihu
4
2.6k
[potatotips #69] Wi-Fi Suggestion API / Wi-Fi Suggestion API
syarihu
2
1.8k
[DroidKaigi 2020] Re:ゼロから始める Play Billing Library / Re: Zero - starting uses of Play Billing Library
syarihu
0
10k
入社から約2年、 Money ForwardのAndroidエンジニアとしての活動を振り返る / Looking back of two years as an Android Engineer of Money Forward
syarihu
1
1.8k
Other Decks in Technology
See All in Technology
どうやってWebサービスのページ表示速度を1/3にしたか / how-to-reduce-display-speed
pinkumohikan
2
470
【OpsJAWS】EC2 のセキュリティの運用と監視について考えてみた件
hssh2_bin
4
590
Autonomous Database - Dedicated 技術詳細 / adb-d_technical_detail_jp
oracle4engineer
PRO
2
4.9k
Proposal for a fictitious company presented by JAWS-UG DE&I team 'Naniwa Musume'
hiroramos4
PRO
0
120
Tohoku.Tech #1 「Cursorを使ったRaspberry Piの開発」by ねこまた
jun2882
0
130
EKSの認証認可の仕組みとEKS APIを用いた認可制御について
daitak
0
250
イベント駆動コンテンツ (a.k.a Webアプリケーションの効率を再定義するBEAR.Sundayの分散キャッシングフレームワーク)
koriym
4
1.6k
新卒1年目がプロジェクトを進めるときにコケたポイント
ryunakayama
1
100
プロデザ! BY リクルートvol.17_『じゃらんnet』公式アプリの高速リニューアル事例を大公開
recruitengineers
PRO
5
110
Pass On What You Have Learned: Deploying to Production
ianlee1521
0
140
都政新報2024年3月1日号
govtechtokyo
0
150
最速思考でバクラク品質を! スタートアップのリアルな課題とQAの実践
nakanao
1
430
Featured
See All Featured
The Brand Is Dead. Long Live the Brand.
mthomps
48
19k
Building Better People: How to give real-time feedback that sticks.
wjessup
350
18k
Intergalactic Javascript Robots from Outer Space
tanoku
266
26k
Fireside Chat
paigeccino
19
2.5k
Designing on Purpose - Digital PM Summit 2013
jponch
109
6.4k
Fantastic passwords and where to find them - at NoRuKo
philnash
35
2.4k
The MySQL Ecosystem @ GitHub 2015
samlambert
242
12k
Designing the Hi-DPI Web
ddemaree
275
33k
Building a Scalable Design System with Sketch
lauravandoore
455
32k
No one is an island. Learnings from fostering a developers community.
thoeni
14
2k
The Straight Up "How To Draw Better" Workshop
denniskardys
227
130k
Building an army of robots
kneath
300
41k
Transcript
license-list-pluginを使って OSSライセンス画面を自動生成する 2020/07/10 (Fri) potatotips #70 @syarihu
Taichi Sato (@syarihu) • Money Forward, Inc. ◦ Android Engineer
• TechBooster
None
OSSライセンス画面を手軽に作るためのツール • oss-licenses-plugin ◦ Google Play Services • LicenseToolsPlugin ◦
cookpad • license-list-plugin ◦ jmatsu
OSSライセンス画面を作るためのツール • oss-licenses-plugin ◦ Google Play Services • LicenseToolsPlugin ◦
cookpad • license-list-plugin ◦ jmatsu
oss-licenses-plugin • Googleが公式で提供している • ライセンスリストを自動生成、特定のActivityを呼び出す だけ ◦ カスタマイズはできない ◦ UIはちょっと微妙
• 一部ライセンスが表示されないなどの問題があった ◦ 依存関係が多い場合に問題に気づきにくい
None
jmatsu/license-list-plugin • ライセンスリストを自動生成し、yamlに定義ファイルを出 力 ◦ 人が読みやすい形なので、ライセンスの追加/変更/削 除も簡単にできる ◦ oss-license-pluginと違いライセンスリストが隠蔽され ていないため、差分も分かりやすい
license-list-plugin • 定義ファイルを元に表示用のhtmlを自動生成したり、カス タマイズした画面を提供するために利用可能なjsonの出 力も可能 • ローカルライブラリにも対応
license-list-plugin • ライセンスリストから除外したいライブラリがある場合 は.artifactignoreに記述することで簡単に除外可能 • cookpad/LicenseToolsPluginを使っている場合は cookpadのプラグインで利用するlicenses.ymlからの移 行も可能
RecyclerView HTML
license-list-pluginへの移行 • oss-licenses-pluginは便利だが、UIが微妙だったり、一 部ライセンスが表示されないなどの問題があったことか ら、ライセンス定義ファイルを自分で管理できたり、機能 が充実しているlicense-list-pluginへ移行することにした
license-list-pluginをどうやって使っているか • 定義ファイルからjsonに吐き出して、jsonを元に RecyclerViewで画面を構築 ◦ 最初作るのは手間だが、アプリのテーマカラーに合わ せられるし、1回作ってしまえばその後は定義ファイル を更新するだけでOK
license-list-pluginをどうやって使っているか • 依存関係の更新時にライセンスリストを更新するのを忘 れてしまう可能性がある ◦ 依存関係を更新したら自動でライセンス定義ファイル を更新するPRを作成
ライセンス定義ファイルを自動で更新するPRを作成 • 依存関係をまとめたファイルDep.ktが変更されたかを Dangerを使って検知 ◦ 検知したらPRに特定のラベルをつける • GitHub Actionsで特定のラベルがついたときに発火する ワークフローを作成
◦ ライセンスリストを更新して自動でPRを立てるジョブを 作る
Dangerfile - 依存関係が更新されている場合はラベルをつける begin target_branch = github.branch_for_base.match(/release|develop/) is_dependencies_updated = git.modified_files.grep(/.*Dep.kt/).empty?
if target_branch && !is_dependencies_updated pr_number = github.pr_json["number"] auto_label.set(pr_number, "Update licenses", "#1d76db") end end
Dangerfile - 依存関係が更新されている場合はラベルをつける begin target_branch = github.branch_for_base.match(/release|develop/) is_dependencies_updated = git.modified_files.grep(/.*Dep.kt/).empty?
if target_branch && !is_dependencies_updated pr_number = github.pr_json["number"] auto_label.set(pr_number, "Update licenses", "#1d76db") end end
Dangerfile - 依存関係が更新されている場合はラベルをつける begin target_branch = github.branch_for_base.match(/release|develop/) is_dependencies_updated = git.modified_files.grep(/.*Dep.kt/).empty?
if target_branch && !is_dependencies_updated pr_number = github.pr_json["number"] auto_label.set(pr_number, "Update licenses", "#1d76db") end end
Dangerfile - 依存関係が更新されている場合はラベルをつける begin target_branch = github.branch_for_base.match(/release|develop/) is_dependencies_updated = git.modified_files.grep(/.*Dep.kt/).empty?
if target_branch && !is_dependencies_updated pr_number = github.pr_json["number"] auto_label.set(pr_number, "Update licenses", "#1d76db") end end
.github/workflow.yml - ラベルがついたら発火する name: Update license list on: pull_request: types:
- labeled
.github/workflow.yml - 特定のラベルのみジョブを実行する jobs: build: runs-on: ubuntu-latest if: github.event.label.name ==
'Update licenses' steps: - uses: actions/checkout@v2 with: ref: ${{ github.head_ref }} - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8
.github/workflow.yml - 特定のラベルのみジョブを実行する jobs: build: runs-on: ubuntu-latest if: github.event.label.name ==
'Update licenses' steps: - uses: actions/checkout@v2 with: ref: ${{ github.head_ref }} - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8
.github/workflow.yml - ライセンス定義ファイルを更新する - name: Update license list run: |
# ライセンス定義ファイルの差分を更新 ./gradlew mergeReleaseLicenseList # 定義ファイルを元にjsonを更新 ./gradlew visualizeReleaseLicenseList
.github/workflow.yml - ライセンス定義ファイルを更新する - name: Update license list run: |
# ライセンス定義ファイルの差分を更新 ./gradlew mergeReleaseLicenseList # 定義ファイルを元にjsonを更新 ./gradlew visualizeReleaseLicenseList
.github/workflow.yml - ライセンス定義ファイルを更新する - name: Update license list run: |
# ライセンス定義ファイルの差分を更新 ./gradlew mergeReleaseLicenseList # 定義ファイルを元にjsonを更新 ./gradlew visualizeReleaseLicenseList
.github/workflow.yml - 自動でPRを作成する - name: Create Pull Request uses: peter-evans/create-pull-request@v2
with: token: ${{ secrets.REPO_ACCESS_TOKEN }} commit-message: Updated license by license-list-plugin committer: syarihu <
[email protected]
> author: syarihu <
[email protected]
> title: Update license body: | This PR has been auto-generated branch: update-license-list branch-suffix: short-commit-hash
.github/workflow.yml - 自動でPRを作成する - name: Create Pull Request uses: peter-evans/create-pull-request@v2
with: token: ${{ secrets.REPO_ACCESS_TOKEN }} commit-message: Updated license by license-list-plugin committer: syarihu <
[email protected]
> author: syarihu <
[email protected]
> title: Update license body: | This PR has been auto-generated branch: update-license-list branch-suffix: short-commit-hash
.github/workflow.yml - 自動でPRを作成する - name: Create Pull Request uses: peter-evans/create-pull-request@v2
with: token: ${{ secrets.REPO_ACCESS_TOKEN }} commit-message: Updated license by license-list-plugin committer: syarihu <
[email protected]
> author: syarihu <
[email protected]
> title: Update license body: | This PR has been auto-generated branch: update-license-list branch-suffix: short-commit-hash
None
None
ライセンス定義ファイルを自動で更新するPRを作成 • これで依存関係を更新したときに自動でPRが作成される ようになったので、ライセンスの更新忘れも無くなり人間 の手間もほとんど無くなった • コミット時に自動でDeployGateにアップロードしてPRに QRコードがコメントされるようにしているので、差分に問題 がない場合はこれで動作確認をするだけでよくなった。最 高!
まとめ • license-list-pluginを使うと定義ファイルの管理が簡単に なる • json出力すればアプリに合ったテーマのOSSライセンス 画面を構築可能 • ライセンス定義ファイルを自動更新、自動PRすれば手間 も更新忘れも無くなる
参考資料 • jmatsu/license-list-plugin: Gradle plugin to manage licenses of your
Android app's dependencies. ◦ https://github.com/jmatsu/license-list-plugin • Including Open Source Notices ◦ https://developers.google.com/android/guides/opensource • cookpad/LicenseToolsPlugin: Gradle plugin to check library licenses and generate license pages for Android ◦ https://github.com/cookpad/LicenseToolsPlugin
ありがとうございました