Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-sdk-tools by
Diff: export/__init__.py
- Revision:
- 23:fbae331171fa
- Parent:
- 13:ab47a20b66f0
- Child:
- 31:182518299918
diff -r 9e85236d8716 -r fbae331171fa export/__init__.py --- a/export/__init__.py Sat Jul 16 00:34:03 2016 +0100 +++ b/export/__init__.py Sat Jul 16 22:51:17 2016 +0100 @@ -21,7 +21,7 @@ from tools.utils import mkdir from tools.export import uvision4, uvision5, codered, gccarm, ds5_5, iar, emblocks, coide, kds, zip, simplicityv3, atmelstudio, sw4stm32, e2studio -from tools.export.exporters import zip_working_directory_and_clean_up, OldLibrariesException +from tools.export.exporters import zip_working_directory_and_clean_up, OldLibrariesException, FailedBuildException from tools.targets import TARGET_NAMES, EXPORT_MAP, TARGET_MAP from project_generator_definitions.definitions import ProGenDef @@ -58,7 +58,8 @@ def export(project_path, project_name, ide, target, destination='/tmp/', - tempdir=None, clean=True, extra_symbols=None, make_zip=True, sources_relative=False, build_url_resolver=online_build_url_resolver): + tempdir=None, pgen_build = False, clean=True, extra_symbols=None, make_zip=True, sources_relative=False, + build_url_resolver=online_build_url_resolver, progen_build=False): # Convention: we are using capitals for toolchain and target names if target is not None: target = target.upper() @@ -68,8 +69,8 @@ use_progen = False supported = True - report = {'success': False, 'errormsg':''} - + report = {'success': False, 'errormsg':'', 'skip': False} + if ide is None or ide == "zip": # Simple ZIP exporter try: @@ -83,6 +84,7 @@ else: if ide not in EXPORTERS: report['errormsg'] = ERROR_MESSAGE_UNSUPPORTED_TOOLCHAIN % (target, ide) + report['skip'] = True else: Exporter = EXPORTERS[ide] target = EXPORT_MAP.get(target, target) @@ -91,24 +93,35 @@ use_progen = True except AttributeError: pass + + if target not in Exporter.TARGETS or Exporter.TOOLCHAIN not in TARGET_MAP[target].supported_toolchains: + supported = False + if use_progen: if not ProGenDef(ide).is_supported(TARGET_MAP[target].progen['target']): supported = False - else: - if target not in Exporter.TARGETS: - supported = False if supported: # target checked, export try: exporter = Exporter(target, tempdir, project_name, build_url_resolver, extra_symbols=extra_symbols, sources_relative=sources_relative) exporter.scan_and_copy_resources(project_path, tempdir, sources_relative) - exporter.generate() - report['success'] = True + if progen_build: + #try to build with pgen ide builders + try: + exporter.generate(progen_build=True) + report['success'] = True + except FailedBuildException, f: + report['errormsg'] = "Build Failed" + else: + exporter.generate() + report['success'] = True except OldLibrariesException, e: report['errormsg'] = ERROR_MESSAGE_NOT_EXPORT_LIBS + else: report['errormsg'] = ERROR_MESSAGE_UNSUPPORTED_TOOLCHAIN % (target, ide) + report['skip'] = True zip_path = None if report['success']: