h-1.flet.3/build.py
2026-02-23 08:57:59 +09:00

48 lines
1.5 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""Androidビルド用スクリプト"""
import subprocess
import sys
def build_android(target: str = "apk") -> bool:
"""販売アシスト1号をAndroidアプリとしてビルド。targetはapk/aab。"""
if target not in {"apk", "aab"}:
print(f"❌ 未対応ターゲット: {target}apk / aab を指定してください)")
return False
print(f"🚀 販売アシスト1号 Androidビルド開始... target={target}")
try:
result = subprocess.run(
["flet", "build", target, ".", "--module-name", "main", "--yes"],
check=True,
capture_output=True,
text=True,
)
print("✅ ビルド成功!")
if result.stdout:
print(result.stdout)
return True
except FileNotFoundError:
print("❌ flet コマンドが見つかりません")
print(" source .venv/bin/activate && pip install flet")
return False
except subprocess.CalledProcessError as e:
print("❌ ビルド失敗:")
if e.stdout:
print(e.stdout)
if e.stderr:
print(e.stderr)
return False
if __name__ == "__main__":
target = "apk"
if len(sys.argv) > 1:
target = sys.argv[1].strip().lower()
if build_android(target):
print(f"\n🎉 Androidビルド完了: {target}")
print("生成物は build/ または dist/ 配下を確認してください")
else:
print("\n💥 ビルドに失敗しました")