make supported in find_apps/build_apps

This commit is contained in:
Fu Hanxi
2020-04-22 14:49:05 +08:00
parent 60437e8ae4
commit dc89e6df6e
7 changed files with 281 additions and 453 deletions

View File

@@ -1,5 +1,10 @@
import logging
import os
from .common import BuildSystem
import subprocess
import sys
import shlex
from .common import BuildSystem, BuildError
# Same for the Makefile projects:
MAKE_PROJECT_LINE = r"include $(IDF_PATH)/make/project.mk"
@@ -12,7 +17,36 @@ class MakeBuildSystem(BuildSystem):
@staticmethod
def build(build_item):
raise NotImplementedError()
build_path, work_path = BuildSystem.build_prepare(build_item)
commands = [
'make clean',
'make defconfig',
'make all',
'make print_flash_cmd',
]
log_file = None
build_stdout = sys.stdout
build_stderr = sys.stderr
if build_item.build_log_path:
logging.info("Writing build log to {}".format(build_item.build_log_path))
log_file = open(build_item.build_log_path, "w")
build_stdout = log_file
build_stderr = log_file
for cmd in commands:
py3 = sys.version_info[0] == 3
if py3:
string_type = str
else:
string_type = basestring
cmd = shlex.split(cmd) if isinstance(cmd, string_type) else cmd
try:
subprocess.check_call(cmd, stdout=build_stdout, stderr=build_stderr, cwd=work_path)
except subprocess.CalledProcessError as e:
if log_file:
log_file.close()
raise BuildError("Build failed with exit code {}".format(e.returncode))
@staticmethod
def is_app(path):
@@ -24,7 +58,3 @@ class MakeBuildSystem(BuildSystem):
if MAKE_PROJECT_LINE not in makefile_content:
return False
return True
@staticmethod
def supported_targets(app_path):
return ["esp32"]