Clone of official tools

Revision:
40:7d3fa6b99b2b
Parent:
36:96847d42f010
Child:
43:2a7da56ebd24
--- a/export/__init__.py	Wed Jul 19 16:44:30 2017 -0500
+++ b/export/__init__.py	Tue Oct 10 16:56:30 2017 -0500
@@ -27,15 +27,13 @@
 
 from tools.build_api import prepare_toolchain
 from tools.build_api import scan_resources
-from tools.toolchains import Resources, mbedToolchain
+from tools.toolchains import Resources
 from tools.export import lpcxpresso, ds5_5, iar, makefile
-from tools.export import embitz, coide, kds, simplicity, atmelstudio
+from tools.export import embitz, coide, kds, simplicity, atmelstudio, mcuxpresso
 from tools.export import sw4stm32, e2studio, zip, cmsis, uvision, cdt, vscode
 from tools.export import gnuarmeclipse
 from tools.export import qtcreator
-from tools.targets import TARGET_NAMES, set_targets_json_location
-from tools.build_profiles import find_build_profile, find_targets_json
-from tools.build_profiles import get_toolchain_profile
+from tools.targets import TARGET_NAMES
 
 EXPORTERS = {
     'uvision5': uvision.Uvision,
@@ -44,6 +42,7 @@
     'gcc_arm': makefile.GccArm,
     'make_gcc_arm': makefile.GccArm,
     'make_armc5': makefile.Armc5,
+    'make_armc6': makefile.Armc6,
     'make_iar': makefile.IAR,
     'ds5_5': ds5_5.DS5_5,
     'iar': iar.IAR,
@@ -58,9 +57,8 @@
     'eclipse_iar'      : cdt.EclipseIAR,
     'eclipse_armc5'    : cdt.EclipseArmc5,
     'gnuarmeclipse': gnuarmeclipse.GNUARMEclipse,
+    'mcuxpresso': mcuxpresso.MCUXpresso,
     'qtcreator': qtcreator.QtCreator,
-    'zip' : zip.ZIP,
-    'cmsis'    : cmsis.CMSIS,
     'vscode_gcc_arm' : vscode.VSCodeGcc,
     'vscode_iar' : vscode.VSCodeIAR,
     'vscode_armc5' : vscode.VSCodeArmc5
@@ -105,7 +103,7 @@
         row = [target]  # First column is platform name
         for ide in supported_ides:
             text = "-"
-            if target in EXPORTERS[ide].TARGETS:
+            if EXPORTERS[ide].is_target_supported(target):
                 if verbose_html:
                     text = "✓"
                 else:
@@ -305,45 +303,6 @@
 
     _, toolchain_name = get_exporter_toolchain(ide)
 
-    ###################################
-    # mbed Classic/2.0/libary support #
-
-    # Find build system profile
-    profile = None
-    targets_json = None
-    for path in paths:
-        profile = find_build_profile(path) or profile
-        if profile:
-            targets_json = join(dirname(dirname(abspath(__file__))), 'legacy_targets.json')
-        else:
-            targets_json = find_targets_json(path) or targets_json
-
-    # Apply targets.json to active targets
-    if targets_json:
-        if not silent:
-            print("Using targets from %s" % targets_json)
-        set_targets_json_location(targets_json)
-
-    # Apply profile to toolchains
-    if profile:
-        def init_hook(self):
-            profile_data = get_toolchain_profile(self.name, profile)
-            if not profile_data:
-                return
-            if not silent:
-                self.info("Using toolchain %s profile %s" % (self.name, profile))
-
-            for k,v in profile_data.items():
-                if self.flags.has_key(k):
-                    self.flags[k] = v
-                else:
-                    setattr(self, k, v)
-
-        mbedToolchain.init = init_hook
-
-    # mbed Classic/2.0/libary support #
-    ###################################
-
     # Pass all params to the unified prepare_resources()
     toolchain = prepare_toolchain(
         paths, "", target, toolchain_name, macros=macros, jobs=jobs,
@@ -351,11 +310,12 @@
         extra_verbose=extra_verbose, config=config, build_profile=build_profile,
         app_config=app_config)
     # The first path will give the name to the library
+    toolchain.RESPONSE_FILES = False
     if name is None:
         name = basename(normpath(abspath(src_paths[0])))
 
     # Call unified scan_resources
-    resource_dict = {loc: scan_resources(path, toolchain, inc_dirs=inc_dirs)
+    resource_dict = {loc: scan_resources(path, toolchain, inc_dirs=inc_dirs, collect_ignores=True)
                      for loc, path in src_paths.iteritems()}
     resources = Resources()
     toolchain.build_dir = export_path
@@ -387,13 +347,14 @@
                 if label not in toolchain.target.features:
                     resource.add(res)
         if isinstance(zip_proj, basestring):
-            zip_export(join(export_path, zip_proj), name, resource_dict, files,
-                       inc_repos)
+            zip_export(join(export_path, zip_proj), name, resource_dict,
+                       files + list(exporter.static_files), inc_repos)
         else:
-            zip_export(zip_proj, name, resource_dict, files, inc_repos)
+            zip_export(zip_proj, name, resource_dict,
+                       files + list(exporter.static_files), inc_repos)
     else:
-        for exported in files:
-            if not exists(join(export_path, basename(exported))):
-                copyfile(exported, join(export_path, basename(exported)))
+        for static_file in exporter.static_files:
+            if not exists(join(export_path, basename(static_file))):
+                copyfile(static_file, join(export_path, basename(static_file)))
 
     return exporter