auto_build_launcher/scripts/project_build.py

37 lines
1.1 KiB
Python

import os.path
from scripts.task import Task
from utils import SystemUtils, CommandUtils
from utils.logger_utils import app_logger
class ProjectBuild(Task):
"""
assembleLawnWithQuickstepPlay
bundleLawnWithQuickstepPlayRelease
"""
def gradlew(self):
gradlew = os.path.abspath(os.path.join(self.context.temp_project_path, "gradlew"))
if SystemUtils.is_windows():
gradlew += ".bat"
return gradlew
def build_apk(self):
cmd = f"{self.gradlew()} assembleLawnWithQuickstepPlay"
app_logger().debug(f"build apk cmd = {cmd}")
return_code, stdout, stderr = CommandUtils.execute(cmd)
app_logger().debug(f"build apk return_code = {return_code} stdout = {stdout}")
def build_aab(self):
cmd = f"{self.gradlew()} bundleLawnWithQuickstepPlayRelease"
app_logger().debug(f"build aab cmd = {cmd}")
return_code, stdout, stderr = CommandUtils.execute(cmd)
app_logger().debug(f"build aab return_code = {return_code} stdout = {stdout}")
def execute(self):
self.build_apk()
self.build_aab()
pass