Merge pull request #2176 from 0xc0170/fix_#2171

Exporters - progen TARGETS lazy evaluated
pull/2185/head
Martin Kojtal 2016-07-15 23:55:48 +01:00 committed by GitHub
commit 7251a8ccae
3 changed files with 42 additions and 29 deletions

View File

@ -35,16 +35,19 @@ class IAREmbeddedWorkbench(Exporter):
MBED_CONFIG_HEADER_SUPPORTED = True MBED_CONFIG_HEADER_SUPPORTED = True
# backward compatibility with our scripts @property
TARGETS = [] def TARGETS(self):
if not hasattr(self, "_targets_supported"):
self._targets_supported = []
for target in TARGET_NAMES: for target in TARGET_NAMES:
try: try:
if (ProGenDef('iar').is_supported(str(TARGET_MAP[target])) or if (ProGenDef('iar').is_supported(str(TARGET_MAP[target])) or
ProGenDef('iar').is_supported(TARGET_MAP[target].progen['target'])): ProGenDef('iar').is_supported(TARGET_MAP[target].progen['target'])):
TARGETS.append(target) self._targets_supported.append(target)
except AttributeError: except AttributeError:
# target is not supported yet # target is not supported yet
continue continue
return self._targets_supported
def generate(self): def generate(self):
""" Generates the project files """ """ Generates the project files """

View File

@ -36,16 +36,19 @@ class Uvision4(Exporter):
MBED_CONFIG_HEADER_SUPPORTED = True MBED_CONFIG_HEADER_SUPPORTED = True
# backward compatibility with our scripts @property
TARGETS = [] def TARGETS(self):
if not hasattr(self, "_targets_supported"):
self._targets_supported = []
for target in TARGET_NAMES: for target in TARGET_NAMES:
try: try:
if (ProGenDef('uvision').is_supported(str(TARGET_MAP[target])) or if (ProGenDef('uvision').is_supported(str(TARGET_MAP[target])) or
ProGenDef('uvision').is_supported(TARGET_MAP[target].progen['target'])): ProGenDef('uvision').is_supported(TARGET_MAP[target].progen['target'])):
TARGETS.append(target) self._targets_supported.append(target)
except AttributeError: except AttributeError:
# target is not supported yet # target is not supported yet
continue continue
return self._targets_supported
def get_toolchain(self): def get_toolchain(self):
return TARGET_MAP[self.target].default_toolchain return TARGET_MAP[self.target].default_toolchain

View File

@ -37,15 +37,22 @@ class Uvision5(Exporter):
MBED_CONFIG_HEADER_SUPPORTED = True MBED_CONFIG_HEADER_SUPPORTED = True
# backward compatibility with our scripts # backward compatibility with our scripts
TARGETS = [] def __init__(self):
self._targets = []
@property
def TARGETS(self):
if not hasattr(self, "_targets_supported"):
self._targets_supported = []
for target in TARGET_NAMES: for target in TARGET_NAMES:
try: try:
if (ProGenDef('uvision5').is_supported(str(TARGET_MAP[target])) or if (ProGenDef('uvision5').is_supported(str(TARGET_MAP[target])) or
ProGenDef('uvision5').is_supported(TARGET_MAP[target].progen['target'])): ProGenDef('uvision5').is_supported(TARGET_MAP[target].progen['target'])):
TARGETS.append(target) self._targets_supported.append(target)
except AttributeError: except AttributeError:
# target is not supported yet # target is not supported yet
continue continue
return self._targets_supported
def get_toolchain(self): def get_toolchain(self):
return TARGET_MAP[self.target].default_toolchain return TARGET_MAP[self.target].default_toolchain