Alessandro Angelino / mbed-tools

Fork of mbed-tools by Morpheus

Revision:
4:395a265b9cd4
Parent:
2:5f044fef8f98
Child:
8:c317ab6dabc4
--- a/project.py	Wed Mar 30 20:14:58 2016 +0000
+++ b/project.py	Thu Mar 31 00:18:15 2016 +0100
@@ -128,15 +128,21 @@
     # Export results
     successes = []
     failures = []
+    zip = True
+    clean = True
 
     for mcu in mcus.split(','):
         # Program Number or name
         p, n, src = options.program, options.program_name, options.source_dir
 
         if src is not None:
+            # --source is used to generate IDE files to toolchain directly in the source tree and doesn't generate zip file
             project_dir = options.source_dir
             project_name = basename(project_dir)
+            project_temp = project_dir
             lib_symbols = []
+            zip = False   # don't create zip
+            clean = False # don't cleanup because we use the actual source tree to generate IDE files
         else:
             if n is not None and p is not None:
                 args_error(parser, "[ERROR] specify either '-n' or '-p', not both")
@@ -185,13 +191,16 @@
             # Build the project with the same directory structure of the mbed online IDE
             project_name = test.id
             project_dir = join(EXPORT_WORKSPACE, project_name)
+            project_temp = EXPORT_TMP
             setup_user_prj(project_dir, test.source_dir, test.dependencies)
 
         # Export to selected toolchain
-        tmp_path, report = export(project_dir, project_name, ide, mcu, project_dir, EXPORT_TMP, extra_symbols=lib_symbols)
+        tmp_path, report = export(project_dir, project_name, ide, mcu, project_dir, project_temp, clean=clean, zip=zip, extra_symbols=lib_symbols)
+        print tmp_path
         if report['success']:
-            zip_path = join(EXPORT_DIR, "%s_%s_%s.zip" % (test.id, ide, mcu))
-            move(tmp_path, zip_path)
+            zip_path = join(EXPORT_DIR, "%s_%s_%s.zip" % (project_name, ide, mcu))
+            if zip:
+                move(tmp_path, zip_path)
             successes.append("%s::%s\t%s"% (mcu, ide, zip_path))
         else:
             failures.append("%s::%s\t%s"% (mcu, ide, report['errormsg']))