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
Cargo-makeを使ってみた
Search
Ryosuke Kamesawa
November 19, 2019
Programming
0
270
Cargo-makeを使ってみた
RustのビルドツールCargoを拡張するタスクランナーCargo-makeの紹介と使ってみた感想を話します。
Ryosuke Kamesawa
November 19, 2019
Tweet
Share
More Decks by Ryosuke Kamesawa
See All by Ryosuke Kamesawa
推論エンジンMAXの紹介
emakryo
1
460
ニューラルネットワークの量子化手法の紹介
emakryo
3
2.6k
MediaPipeの紹介
emakryo
0
41
Customizing Cargo for Cross Compiling
emakryo
0
28
Feature Store in DRIVE CHART
emakryo
0
37
Feature StoreをRustで実装した話
emakryo
0
36
なぜRustか?
emakryo
0
32
rustdef: Rust on Jupyter Notebook
emakryo
0
30
Machine Learning on Graph Data @ICML2019
emakryo
0
16
Other Decks in Programming
See All in Programming
CDKを使ったPagerDuty連携インフラのテンプレート化
shibuya_shogo
0
110
クリーンアーキテクチャから見る依存の向きの大切さ
shimabox
5
1.1k
負債になりにくいCSSをデザイナとつくるには?
fsubal
10
2.6k
たのしいSocketのしくみ / Socket Under a Microscope
coe401_
8
1.4k
もう少しテストを書きたいんじゃ〜 #phpstudy
o0h
PRO
18
4.1k
「個人開発マネタイズ大全」が教えてくれたこと
bani24884
1
240
1年目の私に伝えたい!テストコードを怖がらなくなるためのヒント/Tips for not being afraid of test code
push_gawa
1
620
kintone開発を効率化するためにチームで試した施策とその結果を大放出!
oguemon
0
170
Rubyと自由とAIと
yotii23
6
1.8k
Formの複雑さに立ち向かう
bmthd
1
940
Learning Kotlin with detekt
inouehi
1
140
pylint custom ruleで始めるレビュー自動化
shogoujiie
0
160
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Fontdeck: Realign not Redesign
paulrobertlloyd
83
5.4k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3k
Large-scale JavaScript Application Architecture
addyosmani
511
110k
Into the Great Unknown - MozCon
thekraken
35
1.6k
Code Review Best Practice
trishagee
67
18k
Writing Fast Ruby
sferik
628
61k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7.1k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
193
16k
Thoughts on Productivity
jonyablonski
69
4.5k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Building an army of robots
kneath
303
45k
Transcript
cargo-makeを 使ってみた話 Ryosuke Kamesawa
自己紹介 - 亀澤諒亮, Ryosuke Kamesawa - Twitter: @cruelturtle - 仕事でrustを触り始めた
- 10月〜 - 競プロ・機械学習
Build tool 何使ってます?
Cargo https://doc.rust-lang.org/cargo/
GNU make https://www.gnu.org/graphics/heckert_gnu.html
Build tools - Cargo - Rust標準 - ビルド作業は一通りできる - lint,
compile, link, test, ..etc - GNU Make - 言語に縛られないビルドツールのデファクト - 大抵なんでもできる - 目的のファイルの生成 - PHONYターゲット
Cargo + Make? - Rust projectでも簡単に複雑なタスクを実行したい - makeでいうPHONYターゲット - e.g.
- 自動生成されたコードのclean - CIとして実行される一連のタスク - Cargoがあるのにmakeを使うのも…
Cargo-make???
cargo-make https://sagiegurari.github.io/cargo-make/ Rust task runner and build tool. - Rustに特化したタスクランナー
- Makefile.toml - 様々なタスクの書き方 - Shell command - Shell script - Rust - etc…
Makefile.toml [tasks.all] dependencies = [ "clippy", "test", "reformat", ] [tasks.reformat]
script = ["cargo fmt -- --emit files"]
ここが便利 - Predefined tasks - CIがラク - clippy, coverage, doc,
… - これだけでそれっぽいタスクが走る $ cargo make ci-flow - 自動インストール - e.g. cargo-audit, cargo-tarpaulin, kcov, …
その他の機能 - Profile - 環境変数の切り替え - Platform override - Linux,
Mac, Windowsで切り替え - Conditional execution - Profile, 環境変数等による条件実行 - Watch changes - ファイルの変更を検知して実行 - etc...
ハマりポイント - Predefined task - 意図せずpredefined taskに上書かれてしまう - Dependencies -
(基本的に)上から順に実行 - 依存しているタスクの中で さらに依存関係がある場合は要注意 - Workspaces - デフォルトではworkspaceごとに 別のタスクとして実行される
欠点 - Timestampに応じたビルドはできない - rustのビルドはあくまでcargoの仕事 - Contributeしましょう!(自分でやれ
最後に - 深入りしすぎなければ便利 - cargo-make 是非使ってみてください - 他にいいツールがあったら教えてください