Nettoyage et compilation d'une application

Présentation générale

Avec l'extension de nettoyage et de compilation d'application, vous pouvez nettoyer un projet ou en créer un nouveau.

Script Engine Exemple

# Enable the new python 3 print syntax
from __future__ import print_function
 
# The path to the project
project_path = r"D:\PythonProjects\Example.project"
 
# Clean up any open project:
if projects.primary:
    projects.primary.close()
 
# Load the project
proj = projects.open(project_path);
 
# Fetch the active application.
app = proj.active_application
 
# Clean application
app.clean()
 
# Compile application and store compiler messages in a list
app.build()
for msg_cat in system.get_message_categories():
    if system.get_message_category_description(msg_cat) == "Build":
        messages = system.get_message_objects(msg_cat, Severity.Warning | Severity.Error | Severity.FatalError)
        break
# If length of messages list is 0, the build was successful
    print("--- Build successful ---")
 
# Otherwise print results
else:
    for msg in messages:
        if hasattr(msg, 'object'):
            texts = [str(msg.severity), msg.text, msg.object.get_name()]
        else:
            texts = [str(msg.severity), msg.text]
        
        print("; ".join(texts))