Customwizards: Add a way of wrapping a Generator script.

Add attribute to XML syntax specifying a script to generate files.
The script must provide a --dry-run mode in which it prints the files
it intends to create and their attributes to stdout.
Rework the CustomWizardContext structure to contain target path
and parameter mappings, simplify some code there.
This commit is contained in:
Friedemann Kleint
2010-09-01 13:27:24 +02:00
parent b719bbda42
commit c6132a05f3
12 changed files with 603 additions and 55 deletions

View File

@@ -65,7 +65,14 @@ class GeneratedFilePrivate;
class CORE_EXPORT GeneratedFile
{
public:
enum Attribute { OpenEditorAttribute = 0x01, OpenProjectAttribute = 0x02 };
enum Attribute { // Open this file in editor
OpenEditorAttribute = 0x01,
// Open project
OpenProjectAttribute = 0x02,
/* File is generated by external scripts, do not write out,
* see BaseFileWizard::writeFiles() */
CustomGeneratorAttribute = 0x4
};
Q_DECLARE_FLAGS(Attributes, Attribute)
GeneratedFile();
@@ -200,6 +207,10 @@ protected:
virtual GeneratedFiles generateFiles(const QWizard *w,
QString *errorMessage) const = 0;
/* Physically write files. Re-implement (calling the base implementation)
* to create files with CustomGeneratorAttribute set. */
virtual bool writeFiles(const GeneratedFiles &files, QString *errorMessage);
// Overwrite for ProjectWizard kind and return the path to the generated project file
virtual QString generatedProjectFilePath(const QWizard *wizard) const;