memo: #moddable mcbundleについて
ふと、ししかわさんのツイートを見てmcbundleの存在を思い出した
Moddable Storeという興味深い単語が🤔https://t.co/B6FAEVoELN
— ししかわ/Shinya Ishikawa (@meganetaaan) 2023年3月31日
2年ほど前に実際に動かしてはずなのだが、
mcbundleを実際に動かしてブログか下書きしたような気がしたが何も残ってねえ
— STC (@stc1988) 2023年4月1日
ということなので、改めて実際に動かしてたことのメモ。
mcbundleとは
moddableのアプリケーションをパッケージングするためのツール。冒頭にもあるModdable storeってなに?っていうのをかつてDiscussionsで聞いた気がするが投稿が見つからない。。。回答としては、いづれは所謂アプリストア的なものを見越した仕組み、だった気がする。
使ってみる
stack-chanで複数デバイス向けのリリースを考えてみる
manifest.json
にbundle用の定義を追加する
"bundle": { "id": "tech.moddable.stackchan", "devices": [ "com.m5stack", "com.m5stack.core2" ] }
devicesに指定するデバイスidはmcbundle.jsにある。なお新規デバイス追加に伴う定義の追加はそこそこ漏れている模様。
mcbundle -d -m manifest_local.json
上記実行すると、tech.moddable.stackchan.sh
とこのshから生成されるtech.moddable.stackchan
フォルダとtech.moddable.stackchan,zip
が配置される。
shの中身は以下通り、各デバイスごとにmcconfigでのビルドおよび、必要なファイルをコピーしている。
cat tech.moddable.stackchan.sh #!/bin/bash OUTPUT=/Users/satoshi/Projects/stack-chan/firmware/stackchan/tech.moddable.stackchan rm -R $OUTPUT mkdir $OUTPUT source $IDF_PATH/export.sh echo "# com.m5stack" mcconfig -d -m -p esp32/m5stack -s stackchan.moddable.tech -t build mkdir $OUTPUT/com.m5stack cp $MODDABLE/build/bin/esp32/m5stack/debug/stackchan/bootloader.bin $OUTPUT/com.m5stack/bootloader.bin cp $MODDABLE/build/bin/esp32/m5stack/debug/stackchan/partition-table.bin $OUTPUT/com.m5stack/partition-table.bin cp $MODDABLE/build/bin/esp32/m5stack/debug/stackchan/xs_esp32.bin $OUTPUT/com.m5stack/xs_esp32.bin echo "# com.m5stack.core2" mcconfig -d -m -p esp32/m5stack_core2 -s stackchan.moddable.tech -t build mkdir $OUTPUT/com.m5stack.core2 cp $MODDABLE/build/bin/esp32/m5stack_core2/debug/stackchan/bootloader.bin $OUTPUT/com.m5stack.core2/bootloader.bin cp $MODDABLE/build/bin/esp32/m5stack_core2/debug/stackchan/partition-table.bin $OUTPUT/com.m5stack.core2/partition-table.bin cp $MODDABLE/build/bin/esp32/m5stack_core2/debug/stackchan/xs_esp32.bin $OUTPUT/com.m5stack.core2/xs_esp32.bin rm -f $OUTPUT.zip cd /Users/satoshi/Projects/stack-chan/firmware/stackchan zip -r tech.moddable.stackchan.zip tech.moddable.stackchan find tech.moddable.stackchan/ tech.moddable.stackchan/ tech.moddable.stackchan//com.m5stack.core2 tech.moddable.stackchan//com.m5stack.core2/partition-table.bin tech.moddable.stackchan//com.m5stack.core2/xs_esp32.bin tech.moddable.stackchan//com.m5stack.core2/bootloader.bin tech.moddable.stackchan//com.m5stack tech.moddable.stackchan//com.m5stack/partition-table.bin tech.moddable.stackchan//com.m5stack/xs_esp32.bin tech.moddable.stackchan//com.m5stack/bootloader.bin
まとめ
ここに書いたようなESP Web Toolsと組み合わせせることで、GithubActionsでリリース時にmcbundleで配布用のファイルを生成し、配布という流れに使用できるかもしれない。