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:
parent
3939640965
commit
16885a6033
@ -1481,36 +1481,24 @@ void VcprojGenerator::initResourceFiles()
|
||||
// Bad hack, please look away -------------------------------------
|
||||
QString rcc_dep_cmd = project->values("rcc.depend_command").join(' ');
|
||||
if(!rcc_dep_cmd.isEmpty()) {
|
||||
ProStringList qrc_files = project->values("RESOURCES");
|
||||
const QStringList qrc_files = project->values("RESOURCES").toQStringList();
|
||||
QStringList deps;
|
||||
if(!qrc_files.isEmpty()) {
|
||||
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))
|
||||
+ QLatin1String(" && "));
|
||||
if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) {
|
||||
QString indeps;
|
||||
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);
|
||||
const QString rcc_dep_cd_cmd = QLatin1String("cd ")
|
||||
+ IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false))
|
||||
+ QLatin1String(" && ");
|
||||
for (const QString &qrc_file : qrc_files) {
|
||||
callExtraCompilerDependCommand("rcc",
|
||||
rcc_dep_cd_cmd,
|
||||
rcc_dep_cmd,
|
||||
qrc_file,
|
||||
QString(),
|
||||
true, // dep_lines
|
||||
&deps,
|
||||
false, // existingDepsOnly
|
||||
true // checkCommandavailability
|
||||
);
|
||||
}
|
||||
vcProject.ResourceFiles.addFiles(deps);
|
||||
}
|
||||
// You may look again --------------------------------------------
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user