mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #4107 from theotherjimmy/config-name-app
Allow configuration of artifact name in app configpull/4153/head
commit
e3edbabbcc
|
@ -483,8 +483,8 @@ def build_project(src_paths, build_path, target, toolchain_name,
|
||||||
build_profile=build_profile)
|
build_profile=build_profile)
|
||||||
|
|
||||||
# The first path will give the name to the library
|
# The first path will give the name to the library
|
||||||
if name is None:
|
name = (name or toolchain.config.name or
|
||||||
name = basename(normpath(abspath(src_paths[0])))
|
basename(normpath(abspath(src_paths[0]))))
|
||||||
toolchain.info("Building project %s (%s, %s)" %
|
toolchain.info("Building project %s (%s, %s)" %
|
||||||
(name, toolchain.target.name, toolchain_name))
|
(name, toolchain.target.name, toolchain_name))
|
||||||
|
|
||||||
|
|
|
@ -355,7 +355,8 @@ class Config(object):
|
||||||
"library": {"name": str, "config": dict, "target_overrides": dict,
|
"library": {"name": str, "config": dict, "target_overrides": dict,
|
||||||
"macros": list, "__config_path": str},
|
"macros": list, "__config_path": str},
|
||||||
"application": {"config": dict, "target_overrides": dict,
|
"application": {"config": dict, "target_overrides": dict,
|
||||||
"macros": list, "__config_path": str}
|
"macros": list, "__config_path": str,
|
||||||
|
"artifact_name": str}
|
||||||
}
|
}
|
||||||
|
|
||||||
__unused_overrides = set(["target.bootloader_img", "target.restrict_size"])
|
__unused_overrides = set(["target.bootloader_img", "target.restrict_size"])
|
||||||
|
@ -800,6 +801,13 @@ class Config(object):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@property
|
||||||
|
def name(self):
|
||||||
|
if "artifact_name" in self.app_config_data:
|
||||||
|
return self.app_config_data["artifact_name"]
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
def load_resources(self, resources):
|
def load_resources(self, resources):
|
||||||
""" Load configuration data from a Resources instance and expand it
|
""" Load configuration data from a Resources instance and expand it
|
||||||
based on defined features.
|
based on defined features.
|
||||||
|
|
|
@ -84,10 +84,8 @@ class BuildApiTests(unittest.TestCase):
|
||||||
mock_target = namedtuple("Target",
|
mock_target = namedtuple("Target",
|
||||||
"init_hooks name features core")(lambda _, __ : None,
|
"init_hooks name features core")(lambda _, __ : None,
|
||||||
"Junk", [], "Cortex-M3")
|
"Junk", [], "Cortex-M3")
|
||||||
mock_config_init.return_value = namedtuple("Config",
|
mock_config_init.return_value = namedtuple(
|
||||||
"target has_regions")(
|
"Config", "target has_regions name")(mock_target, False, None)
|
||||||
mock_target,
|
|
||||||
False)
|
|
||||||
|
|
||||||
prepare_toolchain(self.src_paths, None, self.target, self.toolchain_name,
|
prepare_toolchain(self.src_paths, None, self.target, self.toolchain_name,
|
||||||
app_config=app_config)
|
app_config=app_config)
|
||||||
|
@ -106,10 +104,8 @@ class BuildApiTests(unittest.TestCase):
|
||||||
mock_target = namedtuple("Target",
|
mock_target = namedtuple("Target",
|
||||||
"init_hooks name features core")(lambda _, __ : None,
|
"init_hooks name features core")(lambda _, __ : None,
|
||||||
"Junk", [], "Cortex-M3")
|
"Junk", [], "Cortex-M3")
|
||||||
mock_config_init.return_value = namedtuple("Config",
|
mock_config_init.return_value = namedtuple(
|
||||||
"target has_regions")(
|
"Config", "target has_regions name")(mock_target, False, None)
|
||||||
mock_target,
|
|
||||||
False)
|
|
||||||
|
|
||||||
prepare_toolchain(self.src_paths, None, self.target, self.toolchain_name)
|
prepare_toolchain(self.src_paths, None, self.target, self.toolchain_name)
|
||||||
|
|
||||||
|
@ -133,7 +129,8 @@ class BuildApiTests(unittest.TestCase):
|
||||||
app_config = "app_config"
|
app_config = "app_config"
|
||||||
mock_exists.return_value = False
|
mock_exists.return_value = False
|
||||||
mock_prepare_toolchain().link_program.return_value = 1, 2
|
mock_prepare_toolchain().link_program.return_value = 1, 2
|
||||||
mock_prepare_toolchain().config = namedtuple("Config", "has_regions")(None)
|
mock_prepare_toolchain().config = namedtuple(
|
||||||
|
"Config", "has_regions name")(None, None)
|
||||||
|
|
||||||
build_project(self.src_paths, self.build_path, self.target,
|
build_project(self.src_paths, self.build_path, self.target,
|
||||||
self.toolchain_name, app_config=app_config)
|
self.toolchain_name, app_config=app_config)
|
||||||
|
@ -161,7 +158,8 @@ class BuildApiTests(unittest.TestCase):
|
||||||
mock_exists.return_value = False
|
mock_exists.return_value = False
|
||||||
# Needed for the unpacking of the returned value
|
# Needed for the unpacking of the returned value
|
||||||
mock_prepare_toolchain().link_program.return_value = 1, 2
|
mock_prepare_toolchain().link_program.return_value = 1, 2
|
||||||
mock_prepare_toolchain().config = namedtuple("Config", "has_regions")(None)
|
mock_prepare_toolchain().config = namedtuple(
|
||||||
|
"Config", "has_regions name")(None, None)
|
||||||
|
|
||||||
build_project(self.src_paths, self.build_path, self.target,
|
build_project(self.src_paths, self.build_path, self.target,
|
||||||
self.toolchain_name)
|
self.toolchain_name)
|
||||||
|
|
Loading…
Reference in New Issue