Custom wizards: Enhance generator script

following suggestions. Introduce argument syntax in XML allowing for
fine-grained control of handling (omitting empty values, use
temporary files).
This commit is contained in:
Friedemann Kleint
2010-09-03 14:27:13 +02:00
parent 8d169786f4
commit 14f009da05
7 changed files with 323 additions and 133 deletions

View File

@@ -225,7 +225,9 @@ bool CustomWizard::writeFiles(const Core::GeneratedFiles &files, QString *errorM
}
}
// Run the custom script to actually generate the files.
if (!Internal::runCustomWizardGeneratorScript(ctx->targetPath, d->m_parameters->filesGeneratorScriptFullPath(),
if (!Internal::runCustomWizardGeneratorScript(ctx->targetPath,
d->m_parameters->filesGeneratorScript,
d->m_parameters->filesGeneratorScriptArguments,
ctx->replacements, errorMessage))
return false;
// Paranoia: Check on the files generated by the script:
@@ -233,7 +235,7 @@ bool CustomWizard::writeFiles(const Core::GeneratedFiles &files, QString *errorM
if (generatedFile.attributes() & Core::GeneratedFile::CustomGeneratorAttribute)
if (!QFileInfo(generatedFile.path()).isFile()) {
*errorMessage = QString::fromLatin1("%1 failed to generate %2").
arg(d->m_parameters->filesGeneratorScript, generatedFile.path());
arg(d->m_parameters->filesGeneratorScript.back(), generatedFile.path());
return false;
}
return true;
@@ -253,7 +255,8 @@ Core::GeneratedFiles CustomWizard::generateWizardFiles(QString *errorMessage) co
// If generator script is non-empty, do a dry run to get it's files.
if (!d->m_parameters->filesGeneratorScript.isEmpty()) {
rc += Internal::dryRunCustomWizardGeneratorScript(ctx->targetPath,
d->m_parameters->filesGeneratorScriptFullPath(),
d->m_parameters->filesGeneratorScript,
d->m_parameters->filesGeneratorScriptArguments,
ctx->replacements, errorMessage);
if (rc.isEmpty())
return rc;