Salome HOME
sat jobs: remove the empty columns from the boards.
[tools/sat.git] / commands / compile.py
index ece2588a9d7956069d5e7e6b30286eb54b9c86e6..e4a6449ea6f4645a1317841b7f18cca146af28de 100644 (file)
@@ -54,6 +54,9 @@ parser.add_option('', 'stop_first_fail', 'boolean', 'stop_first_fail', _(
 parser.add_option('', 'check', 'boolean', 'check', _(
                   "Optional: execute the unit tests after compilation"), False)
 
+parser.add_option('', 'clean_build_after', 'boolean', 'clean_build_after', 
+                  _('Optional: remove the build directory after successful compilation'), False)
+
 def get_products_list(options, cfg, logger):
     '''method that gives the product list with their informations from 
        configuration regarding the passed options.
@@ -329,6 +332,10 @@ def compile_all_products(sat, config, options, products_infos, logger):
                       verbose=0,
                       logger_add_link = logger)
         
+        # Recompute the product information to get the right install_dir
+        # (it could change if there is a clean of the install directory)
+        p_info = src.product.get_product_config(config, p_name)
+        
         # Check if it was already successfully installed
         if src.product.check_installation(p_info):
             logger.write(_("Already installed\n"))
@@ -373,7 +380,17 @@ def compile_all_products(sat, config, options, products_infos, logger):
                           batch=True,
                           verbose=0,
                           logger_add_link = logger)
-            
+        else:
+            # Clean the build directory if the compilation and tests succeed
+            if options.clean_build_after:
+                log_step(logger, header, "CLEAN BUILD")
+                sat.clean(config.VARS.application + 
+                          " --products " + p_name + 
+                          " --build",
+                          batch=True,
+                          verbose=0,
+                          logger_add_link = logger)
+
         # Log the result
         if res_prod > 0:
             logger.write("\r%s%s" % (header, " " * len_end_line), 3)
@@ -683,4 +700,4 @@ def run(args, runner, logger):
     code = res
     if code != 0:
         code = 1
-    return code
\ No newline at end of file
+    return code