2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-15 19:55:27 +00:00
Files
inventree-app/tasks.py
Asterix\Oliver c5dc40441f Tweak command
2025-06-14 10:43:25 +10:00

48 lines
1.1 KiB
Python

"""Invoke tasks for building the InvenTree mobile app."""
import os
import sys
from invoke import task
@task
def clean(c):
"""Clean flutter build."""
c.run("flutter clean")
@task
def update(c):
"""Update flutter dependencies."""
c.run("flutter pub get")
@task
def translate(c):
"""Update translation files."""
here = os.path.dirname(__file__)
l10_dir = os.path.join(here, 'lib', 'l10n')
l10_dir = os.path.abspath(l10_dir)
python = 'python3' if sys.platform.lower() == 'darwin' else 'python'
c.run(f"cd {l10_dir} && {python} collect_translations.py")
@task(pre=[clean, update, translate])
def ios(c):
"""Build iOS app in release configuration."""
c.run("flutter build ipa --release --no-tree-shake-icons")
@task(pre=[clean, update, translate])
def android(c):
"""Build Android app in release configuration."""
c.run("flutter build appbundle --release --no-tree-shake-icons")
@task
def format(c, analyze=False, dry_run=False):
"""Format Dart code."""
c.run(f"dart format .{" --output=none" if dry_run else ''}")
if analyze:
c.run("flutter analyze")