Clone of official tools

Revision:
8:a8ac6ed29081
Parent:
7:5af61d55adbe
Child:
9:2d27d77ada5c
--- a/build_api.py	Tue Jun 07 11:21:44 2016 +0100
+++ b/build_api.py	Tue Jun 07 11:35:02 2016 +0100
@@ -23,8 +23,9 @@
 from types import ListType
 from shutil import rmtree
 from os.path import join, exists, basename, abspath, normpath
-from os import getcwd
+from os import getcwd, walk
 from time import time
+from copy import copy
 
 from tools.utils import mkdir, run_cmd, run_cmd_ext, NotSupportedException, ToolException
 from tools.paths import MBED_TARGETS_PATH, MBED_LIBRARIES, MBED_API, MBED_HAL, MBED_COMMON
@@ -125,6 +126,9 @@
     abs_path = abspath(first_src_path)
     project_name = basename(normpath(abs_path))
 
+    for path in src_paths:
+        profile = get_build_profile(path)
+
     # If the configuration object was not yet created, create it now
     config = config or Config(target, src_paths)
 
@@ -137,7 +141,7 @@
 
     # Toolchain instance
     try:
-        toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, notify, macros, silent, extra_verbose=extra_verbose)
+        toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, notify, macros, silent, extra_verbose=extra_verbose, profile=profile)
     except KeyError as e:
         raise KeyError("Toolchain %s not supported" % toolchain_name)
 
@@ -290,9 +294,12 @@
 
             raise Exception(error_msg)
 
+    for path in src_paths:
+        profile = get_build_profile(path)
+
     try:
         # Toolchain instance
-        toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify, silent=silent, extra_verbose=extra_verbose)
+        toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify, silent=silent, extra_verbose=extra_verbose, profile=profile)
         toolchain.VERBOSE = verbose
         toolchain.jobs = jobs
         toolchain.build_all = clean