De-duplicate the last occurrence of calling a depend_command

Use the central callExtraCompilerDependCommand in the last place where
the code to call an extra compiler's depend_command was duplicated.

Note that this is in the "Bad hack" section. We're making this hack less
bad, but the comment still applies.

Change-Id: Iaa857af20ca46b2d73053d3e264c63124c87a41b
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Joerg Bornemann 2020-01-02 14:16:21 +01:00
parent 3939640965
commit 16885a6033

View File

@ -1481,37 +1481,25 @@ void VcprojGenerator::initResourceFiles()
// Bad hack, please look away ------------------------------------- // Bad hack, please look away -------------------------------------
QString rcc_dep_cmd = project->values("rcc.depend_command").join(' '); QString rcc_dep_cmd = project->values("rcc.depend_command").join(' ');
if(!rcc_dep_cmd.isEmpty()) { if(!rcc_dep_cmd.isEmpty()) {
ProStringList qrc_files = project->values("RESOURCES"); const QStringList qrc_files = project->values("RESOURCES").toQStringList();
QStringList deps; QStringList deps;
if(!qrc_files.isEmpty()) { const QString rcc_dep_cd_cmd = QLatin1String("cd ")
for (int i = 0; i < qrc_files.count(); ++i) {
char buff[256];
QString dep_cmd = replaceExtraCompilerVariables(
rcc_dep_cmd, qrc_files.at(i).toQString(), QString(), LocalShell);
dep_cmd = Option::fixPathToLocalOS(dep_cmd, true, false);
if(canExecute(dep_cmd)) {
dep_cmd.prepend(QLatin1String("cd ")
+ IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false)) + IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false))
+ QLatin1String(" && ")); + QLatin1String(" && ");
if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) { for (const QString &qrc_file : qrc_files) {
QString indeps; callExtraCompilerDependCommand("rcc",
while(!feof(proc)) { rcc_dep_cd_cmd,
int read_in = (int)fread(buff, 1, 255, proc); rcc_dep_cmd,
if(!read_in) qrc_file,
break; QString(),
indeps += QByteArray(buff, read_in); true, // dep_lines
} &deps,
QT_PCLOSE(proc); false, // existingDepsOnly
if(!indeps.isEmpty()) true // checkCommandavailability
deps += fileFixify(indeps.replace('\n', ' ').simplified().split(' '), );
FileFixifyFromOutdir);
}
}
} }
vcProject.ResourceFiles.addFiles(deps); vcProject.ResourceFiles.addFiles(deps);
} }
}
// You may look again -------------------------------------------- // You may look again --------------------------------------------
vcProject.ResourceFiles.addFiles(project->values("RESOURCES")); vcProject.ResourceFiles.addFiles(project->values("RESOURCES"));