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,36 +1481,24 @@ 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) { + IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false))
char buff[256]; + QLatin1String(" && ");
QString dep_cmd = replaceExtraCompilerVariables( for (const QString &qrc_file : qrc_files) {
rcc_dep_cmd, qrc_files.at(i).toQString(), QString(), LocalShell); callExtraCompilerDependCommand("rcc",
rcc_dep_cd_cmd,
dep_cmd = Option::fixPathToLocalOS(dep_cmd, true, false); rcc_dep_cmd,
if(canExecute(dep_cmd)) { qrc_file,
dep_cmd.prepend(QLatin1String("cd ") QString(),
+ IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false)) true, // dep_lines
+ QLatin1String(" && ")); &deps,
if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) { false, // existingDepsOnly
QString indeps; true // checkCommandavailability
while(!feof(proc)) { );
int read_in = (int)fread(buff, 1, 255, proc);
if(!read_in)
break;
indeps += QByteArray(buff, read_in);
}
QT_PCLOSE(proc);
if(!indeps.isEmpty())
deps += fileFixify(indeps.replace('\n', ' ').simplified().split(' '),
FileFixifyFromOutdir);
}
}
}
vcProject.ResourceFiles.addFiles(deps);
} }
vcProject.ResourceFiles.addFiles(deps);
} }
// You may look again -------------------------------------------- // You may look again --------------------------------------------