|
|
@@ -17,6 +17,16 @@ NAME_PLACEHOLDER = "@n"
|
|
|
FULL_NAME_PLACEHOLDER = "@f"
|
|
|
INDEX_PLACEHOLDER = "@i"
|
|
|
|
|
|
+SDKCONFIG_LINE_REGEX = re.compile(r"^([^=]+)=\"?([^\"\n]*)\"?\n*$")
|
|
|
+
|
|
|
+# If these keys are present in sdkconfig.defaults, they will be extracted and passed to CMake
|
|
|
+SDKCONFIG_TEST_OPTS = [
|
|
|
+ "EXCLUDE_COMPONENTS",
|
|
|
+ "TEST_EXCLUDE_COMPONENTS",
|
|
|
+ "TEST_COMPONENTS",
|
|
|
+ "TEST_GROUPS"
|
|
|
+]
|
|
|
+
|
|
|
# ConfigRule represents one --config argument of find_apps.py.
|
|
|
# file_name is the name of the sdkconfig file fragment, optionally with a single wildcard ('*' character).
|
|
|
# file_name can also be empty to indicate that the default configuration of the app should be used.
|
|
|
@@ -195,12 +205,11 @@ class BuildSystem(object):
|
|
|
Derived classes implement the methods below.
|
|
|
Objects of these classes aren't instantiated, instead the class (type object) is used.
|
|
|
"""
|
|
|
-
|
|
|
NAME = "undefined"
|
|
|
SUPPORTED_TARGETS_REGEX = re.compile(r'Supported [Tt]argets((?:[\s|]+(?:ESP[0-9A-Z\-]+))+)')
|
|
|
|
|
|
- @staticmethod
|
|
|
- def build_prepare(build_item):
|
|
|
+ @classmethod
|
|
|
+ def build_prepare(cls, build_item):
|
|
|
app_path = build_item.app_dir
|
|
|
work_path = build_item.work_dir or app_path
|
|
|
if not build_item.build_dir:
|
|
|
@@ -244,6 +253,7 @@ class BuildSystem(object):
|
|
|
os.unlink(sdkconfig_file)
|
|
|
|
|
|
logging.debug("Creating sdkconfig file: {}".format(sdkconfig_file))
|
|
|
+ extra_cmakecache_items = {}
|
|
|
if not build_item.dry_run:
|
|
|
with open(sdkconfig_file, "w") as f_out:
|
|
|
for sdkconfig_name in sdkconfig_defaults_list:
|
|
|
@@ -255,13 +265,12 @@ class BuildSystem(object):
|
|
|
for line in f_in:
|
|
|
if not line.endswith("\n"):
|
|
|
line += "\n"
|
|
|
+ if cls.NAME == 'cmake':
|
|
|
+ m = SDKCONFIG_LINE_REGEX.match(line)
|
|
|
+ if m and m.group(1) in SDKCONFIG_TEST_OPTS:
|
|
|
+ extra_cmakecache_items[m.group(1)] = m.group(2)
|
|
|
+ continue
|
|
|
f_out.write(os.path.expandvars(line))
|
|
|
- # Also save the sdkconfig file in the build directory
|
|
|
- shutil.copyfile(
|
|
|
- os.path.join(work_path, "sdkconfig"),
|
|
|
- os.path.join(build_path, "sdkconfig"),
|
|
|
- )
|
|
|
-
|
|
|
else:
|
|
|
for sdkconfig_name in sdkconfig_defaults_list:
|
|
|
sdkconfig_path = os.path.join(app_path, sdkconfig_name)
|
|
|
@@ -273,7 +282,10 @@ class BuildSystem(object):
|
|
|
logging.debug("Appending {} to sdkconfig".format(sdkconfig_name))
|
|
|
|
|
|
# The preparation of build is finished. Implement the build part in sub classes.
|
|
|
- return build_path, work_path
|
|
|
+ if cls.NAME == 'cmake':
|
|
|
+ return build_path, work_path, extra_cmakecache_items
|
|
|
+ else:
|
|
|
+ return build_path, work_path
|
|
|
|
|
|
@staticmethod
|
|
|
@abstractmethod
|