Clone of official tools

Revision:
36:96847d42f010
Parent:
35:da9c89f8be7d
Child:
38:399953da035d
--- a/build.py	Wed Feb 15 13:53:18 2017 -0600
+++ b/build.py	Thu Jun 22 11:12:28 2017 -0500
@@ -34,7 +34,6 @@
 from tools.options import extract_profile
 from tools.build_api import build_library, build_mbed_libs, build_lib
 from tools.build_api import mcu_toolchain_matrix
-from tools.build_api import static_analysis_scan, static_analysis_scan_lib, static_analysis_scan_library
 from tools.build_api import print_build_results
 from tools.settings import CPPCHECK_CMD, CPPCHECK_MSG_FORMAT
 from utils import argparse_filestring_type, args_error
@@ -69,17 +68,6 @@
                       default=False,
                       help="Compile the rpc library")
 
-    parser.add_argument("-e", "--eth",
-                      action="store_true", dest="eth",
-                      default=False,
-                      help="Compile the ethernet library")
-
-    parser.add_argument("-U", "--usb_host",
-                      action="store_true",
-                      dest="usb_host",
-                      default=False,
-                      help="Compile the USB Host library")
-
     parser.add_argument("-u", "--usb",
                       action="store_true",
                       dest="usb",
@@ -92,18 +80,6 @@
                       default=False,
                       help="Compile the DSP library")
 
-    parser.add_argument("-F", "--fat",
-                      action="store_true",
-                      dest="fat",
-                      default=False,
-                      help="Compile FS and SD card file system library")
-
-    parser.add_argument("-b", "--ublox",
-                      action="store_true",
-                      dest="ublox",
-                      default=False,
-                      help="Compile the u-blox library")
-
     parser.add_argument( "--cpputest",
                       action="store_true",
                       dest="cpputest_lib",
@@ -126,12 +102,6 @@
                       default=None,
                       help='For some commands you can use filter to filter out results')
 
-    parser.add_argument("--cppcheck",
-                      action="store_true",
-                      dest="cppcheck_validation",
-                      default=False,
-                      help="Forces 'cppcheck' static code analysis")
-
     parser.add_argument("-j", "--jobs", type=int, dest="jobs",
                       default=0, help="Number of concurrent jobs. Default: 0/auto (based on host machine's number of CPUs)")
     parser.add_argument("-N", "--artifact-name", dest="artifact_name",
@@ -187,22 +157,12 @@
     libraries = []
 
     # Additional Libraries
-    if options.rtos:
-        libraries.extend(["rtx", "rtos"])
     if options.rpc:
         libraries.extend(["rpc"])
-    if options.eth:
-        libraries.append("eth")
     if options.usb:
         libraries.append("usb")
-    if options.usb_host:
-        libraries.append("usb_host")
     if options.dsp:
         libraries.extend(["dsp"])
-    if options.fat:
-        libraries.extend(["fat"])
-    if options.ublox:
-        libraries.extend(["rtx", "rtos", "usb_host", "ublox"])
     if options.cpputest_lib:
         libraries.extend(["cpputest"])
 
@@ -220,84 +180,56 @@
 
     for toolchain in toolchains:
         for target in targets:
-            # CPPCHECK code validation
-            if options.cppcheck_validation:
+            tt_id = "%s::%s" % (toolchain, target)
+            if toolchain not in TARGET_MAP[target].supported_toolchains:
+                # Log this later
+                print "%s skipped: toolchain not supported" % tt_id
+                skipped.append(tt_id)
+            else:
                 try:
                     mcu = TARGET_MAP[target]
-                    # CMSIS and MBED libs analysis
                     profile = extract_profile(parser, options, toolchain)
-                    static_analysis_scan(
-                        mcu, toolchain, CPPCHECK_CMD, CPPCHECK_MSG_FORMAT,
-                        verbose=options.verbose, jobs=options.jobs,
-                        build_profile=profile)
+                    if options.source_dir:
+                        lib_build_res = build_library(options.source_dir, options.build_dir, mcu, toolchain,
+                                                    extra_verbose=options.extra_verbose_notify,
+                                                    verbose=options.verbose,
+                                                    silent=options.silent,
+                                                    jobs=options.jobs,
+                                                    clean=options.clean,
+                                                    archive=(not options.no_archive),
+                                                    macros=options.macros,
+                                                    name=options.artifact_name,
+                                                    build_profile=profile)
+                    else:
+                        lib_build_res = build_mbed_libs(mcu, toolchain,
+                                                    extra_verbose=options.extra_verbose_notify,
+                                                    verbose=options.verbose,
+                                                    silent=options.silent,
+                                                    jobs=options.jobs,
+                                                    clean=options.clean,
+                                                        macros=options.macros,
+                                                        build_profile=profile)
+
                     for lib_id in libraries:
-                        # Static check for library
-                        static_analysis_scan_lib(
-                            lib_id, mcu, toolchain, CPPCHECK_CMD,
-                            CPPCHECK_MSG_FORMAT,
-                            extra_verbose=options.extra_verbose_notify,
-                            verbose=options.verbose, jobs=options.jobs,
-                            clean=options.clean, macros=options.macros,
-                            build_profile=profile)
-                        pass
+                        build_lib(lib_id, mcu, toolchain,
+                                extra_verbose=options.extra_verbose_notify,
+                                verbose=options.verbose,
+                                silent=options.silent,
+                                clean=options.clean,
+                                macros=options.macros,
+                                    jobs=options.jobs,
+                                    build_profile=profile)
+                    if lib_build_res:
+                        successes.append(tt_id)
+                    else:
+                        skipped.append(tt_id)
                 except Exception, e:
                     if options.verbose:
                         import traceback
                         traceback.print_exc(file=sys.stdout)
                         sys.exit(1)
+                    failures.append(tt_id)
                     print e
-            else:
-                # Build
-                tt_id = "%s::%s" % (toolchain, target)
-                if toolchain not in TARGET_MAP[target].supported_toolchains:
-                    # Log this later
-                    print "%s skipped: toolchain not supported" % tt_id
-                    skipped.append(tt_id)
-                else:
-                    try:
-                        mcu = TARGET_MAP[target]
-                        profile = extract_profile(parser, options, toolchain)
-                        if options.source_dir:
-                            lib_build_res = build_library(options.source_dir, options.build_dir, mcu, toolchain,
-                                                        extra_verbose=options.extra_verbose_notify,
-                                                        verbose=options.verbose,
-                                                        silent=options.silent,
-                                                        jobs=options.jobs,
-                                                        clean=options.clean,
-                                                        archive=(not options.no_archive),
-                                                        macros=options.macros,
-                                                        name=options.artifact_name,
-                                                        build_profile=profile)
-                        else:
-                            lib_build_res = build_mbed_libs(mcu, toolchain,
-                                                        extra_verbose=options.extra_verbose_notify,
-                                                        verbose=options.verbose,
-                                                        silent=options.silent,
-                                                        jobs=options.jobs,
-                                                        clean=options.clean,
-                                                            macros=options.macros,
-                                                            build_profile=profile)
-
-                        for lib_id in libraries:
-                            build_lib(lib_id, mcu, toolchain,
-                                    extra_verbose=options.extra_verbose_notify,
-                                    verbose=options.verbose,
-                                    silent=options.silent,
-                                    clean=options.clean,
-                                    macros=options.macros,
-                                      jobs=options.jobs,
-                                      build_profile=profile)
-                        if lib_build_res:
-                            successes.append(tt_id)
-                        else:
-                            skipped.append(tt_id)
-                    except Exception, e:
-                        if options.verbose:
-                            import traceback
-                            traceback.print_exc(file=sys.stdout)
-                            sys.exit(1)
-                        failures.append(tt_id)
-                        print e
 
 
     # Write summary of the builds