don't overuse variables()
Change-Id: Ib2da88e5e29c0bfecc39a9c06e82a34a4bd0b1e6 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
This commit is contained in:
parent
cb43947738
commit
6957cb26b3
@ -448,14 +448,14 @@ MakefileGenerator::init()
|
||||
continue_compiler_chain:
|
||||
if(jump_count > quc.size()) //just to avoid an infinite loop here
|
||||
break;
|
||||
if(project->variables().contains(quc.at(comp_out) + ".variable_out")) {
|
||||
const QStringList &outputs = project->variables().value(quc.at(comp_out) + ".variable_out");
|
||||
if (v.contains(quc.at(comp_out) + ".variable_out")) {
|
||||
const QStringList &outputs = v.value(quc.at(comp_out) + ".variable_out");
|
||||
for(int out = 0; out < outputs.size(); ++out) {
|
||||
for(int comp_in = 0; comp_in < quc.size(); ++comp_in) {
|
||||
if(comp_in == comp_out)
|
||||
continue;
|
||||
if(project->variables().contains(quc.at(comp_in) + ".input")) {
|
||||
const QStringList &inputs = project->variables().value(quc.at(comp_in) + ".input");
|
||||
if (v.contains(quc.at(comp_in) + ".input")) {
|
||||
const QStringList &inputs = v.value(quc.at(comp_in) + ".input");
|
||||
for(int in = 0; in < inputs.size(); ++in) {
|
||||
if(inputs.at(in) == outputs.at(out) && comp_out > comp_in) {
|
||||
++jump_count;
|
||||
@ -680,8 +680,8 @@ MakefileGenerator::init()
|
||||
continue;
|
||||
QString out = fileFixify(tmp_out, Option::output_dir, Option::output_dir);
|
||||
bool pre_dep = (project->values((*it) + ".CONFIG").indexOf("target_predeps") != -1);
|
||||
if(project->variables().contains((*it) + ".variable_out")) {
|
||||
const QStringList &var_out = project->variables().value((*it) + ".variable_out");
|
||||
if (v.contains((*it) + ".variable_out")) {
|
||||
const QStringList &var_out = v.value((*it) + ".variable_out");
|
||||
for(int i = 0; i < var_out.size(); ++i) {
|
||||
QString v = var_out.at(i);
|
||||
if(v == QLatin1String("SOURCES"))
|
||||
@ -703,7 +703,7 @@ MakefileGenerator::init()
|
||||
list.append(out);
|
||||
}
|
||||
if(pre_dep) {
|
||||
QStringList &list = project->variables()["PRE_TARGETDEPS"];
|
||||
QStringList &list = project->values("PRE_TARGETDEPS");
|
||||
if(!list.contains(out))
|
||||
list.append(out);
|
||||
}
|
||||
@ -721,8 +721,8 @@ MakefileGenerator::init()
|
||||
QString out = replaceExtraCompilerVariables(tmp_out, (*input), QString());
|
||||
out = fileFixify(out, Option::output_dir, Option::output_dir);
|
||||
bool pre_dep = (project->values((*it) + ".CONFIG").indexOf("target_predeps") != -1);
|
||||
if(project->variables().contains((*it) + ".variable_out")) {
|
||||
const QStringList &var_out = project->variables().value((*it) + ".variable_out");
|
||||
if (v.contains((*it) + ".variable_out")) {
|
||||
const QStringList &var_out = project->values(*it + ".variable_out");
|
||||
for(int i = 0; i < var_out.size(); ++i) {
|
||||
QString v = var_out.at(i);
|
||||
if(v == QLatin1String("SOURCES"))
|
||||
@ -744,7 +744,7 @@ MakefileGenerator::init()
|
||||
list.append(out);
|
||||
}
|
||||
if(pre_dep) {
|
||||
QStringList &list = project->variables()["PRE_TARGETDEPS"];
|
||||
QStringList &list = project->values("PRE_TARGETDEPS");
|
||||
if(!list.contains(out))
|
||||
list.append(out);
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ BuildsMetaMakefileGenerator::init()
|
||||
return false;
|
||||
init_flag = true;
|
||||
|
||||
const QStringList &builds = project->variables()["BUILDS"];
|
||||
const QStringList &builds = project->values("BUILDS");
|
||||
bool use_single_build = builds.isEmpty();
|
||||
if(builds.count() > 1 && Option::output.fileName() == "-") {
|
||||
use_single_build = true;
|
||||
@ -347,7 +347,7 @@ SubdirsMetaMakefileGenerator::init()
|
||||
qmake_setpwd(sub->input_dir);
|
||||
Option::output_dir = sub->output_dir;
|
||||
bool tmpError = !sub_proj->read(subdir.fileName());
|
||||
if(!sub_proj->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) {
|
||||
if (!sub_proj->isEmpty("QMAKE_FAILED_REQUIREMENTS")) {
|
||||
fprintf(stderr, "Project file(%s) not recursed because all requirements not met:\n\t%s\n",
|
||||
subdir.fileName().toLatin1().constData(),
|
||||
sub_proj->values("QMAKE_FAILED_REQUIREMENTS").join(" ").toLatin1().constData());
|
||||
|
@ -77,7 +77,7 @@ ProjectGenerator::init()
|
||||
verifyCompilers();
|
||||
|
||||
project->read(QMakeProject::ReadFeatures);
|
||||
project->variables()["CONFIG"].clear();
|
||||
project->values("CONFIG").clear();
|
||||
|
||||
QHash<QString, QStringList> &v = project->variables();
|
||||
QString templ = Option::user_template.isEmpty() ? QString("app") : Option::user_template;
|
||||
@ -297,13 +297,13 @@ ProjectGenerator::init()
|
||||
}
|
||||
|
||||
//strip out files that are actually output from internal compilers (ie temporary files)
|
||||
const QStringList &quc = project->variables()["QMAKE_EXTRA_COMPILERS"];
|
||||
const QStringList &quc = project->values("QMAKE_EXTRA_COMPILERS");
|
||||
for(QStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) {
|
||||
QString tmp_out = project->variables()[(*it) + ".output"].first();
|
||||
QString tmp_out = project->first((*it) + ".output");
|
||||
if(tmp_out.isEmpty())
|
||||
continue;
|
||||
|
||||
QStringList var_out = project->variables()[(*it) + ".variable_out"];
|
||||
QStringList var_out = project->values((*it) + ".variable_out");
|
||||
bool defaults = var_out.isEmpty();
|
||||
for(int i = 0; i < var_out.size(); ++i) {
|
||||
QString v = var_out.at(i);
|
||||
@ -317,15 +317,15 @@ ProjectGenerator::init()
|
||||
var_out << "HEADERS";
|
||||
var_out << "FORMS";
|
||||
}
|
||||
const QStringList &tmp = project->variables()[(*it) + ".input"];
|
||||
const QStringList &tmp = project->values((*it) + ".input");
|
||||
for(QStringList::ConstIterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) {
|
||||
QStringList &inputs = project->variables()[(*it2)];
|
||||
QStringList &inputs = project->values(*it2);
|
||||
for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) {
|
||||
QString path = replaceExtraCompilerVariables(tmp_out, (*input), QString());
|
||||
path = fixPathToQmake(path).section('/', -1);
|
||||
for(int i = 0; i < var_out.size(); ++i) {
|
||||
QString v = var_out.at(i);
|
||||
QStringList &list = project->variables()[v];
|
||||
QStringList &list = project->values(v);
|
||||
for(int src = 0; src < list.size(); ) {
|
||||
if(list[src] == path || list[src].endsWith("/" + path))
|
||||
list.removeAt(src);
|
||||
@ -356,7 +356,7 @@ ProjectGenerator::writeMakefile(QTextStream &t)
|
||||
QString ofn = QFileInfo(static_cast<QFile *>(t.device())->fileName()).completeBaseName();
|
||||
if (ofn.isEmpty() || ofn == "-")
|
||||
ofn = "unknown";
|
||||
project->variables()["TARGET_ASSIGN"] = QStringList(ofn);
|
||||
project->values("TARGET_ASSIGN") = QStringList(ofn);
|
||||
|
||||
t << getWritableVar("TARGET_ASSIGN")
|
||||
<< getWritableVar("CONFIG", false)
|
||||
@ -384,8 +384,8 @@ ProjectGenerator::addConfig(const QString &cfg, bool add)
|
||||
QString where = "CONFIG";
|
||||
if(!add)
|
||||
where = "CONFIG_REMOVE";
|
||||
if(!project->variables()[where].contains(cfg)) {
|
||||
project->variables()[where] += cfg;
|
||||
if (!project->values(where).contains(cfg)) {
|
||||
project->values(where) += cfg;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -439,7 +439,7 @@ ProjectGenerator::addFile(QString file)
|
||||
|
||||
QString newfile = fixPathToQmake(fileFixify(file));
|
||||
|
||||
QStringList &endList = project->variables()[where];
|
||||
QStringList &endList = project->values(where);
|
||||
if(!endList.contains(newfile, Qt::CaseInsensitive)) {
|
||||
endList += newfile;
|
||||
return true;
|
||||
@ -450,7 +450,7 @@ ProjectGenerator::addFile(QString file)
|
||||
QString
|
||||
ProjectGenerator::getWritableVar(const QString &v, bool)
|
||||
{
|
||||
QStringList &vals = project->variables()[v];
|
||||
QStringList &vals = project->values(v);
|
||||
if(vals.isEmpty())
|
||||
return "";
|
||||
|
||||
|
@ -2181,11 +2181,11 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
|
||||
|
||||
// All information about the extra compiler
|
||||
QString tmp_out = Project->project->first(extraCompilerName + ".output");
|
||||
QString tmp_cmd = Project->project->variables()[extraCompilerName + ".commands"].join(" ");
|
||||
QString tmp_cmd_name = Project->project->variables()[extraCompilerName + ".name"].join(" ");
|
||||
QStringList tmp_dep = Project->project->variables()[extraCompilerName + ".depends"];
|
||||
QString tmp_dep_cmd = Project->project->variables()[extraCompilerName + ".depend_command"].join(" ");
|
||||
QStringList configs = Project->project->variables()[extraCompilerName + ".CONFIG"];
|
||||
QString tmp_cmd = Project->project->values(extraCompilerName + ".commands").join(" ");
|
||||
QString tmp_cmd_name = Project->project->values(extraCompilerName + ".name").join(" ");
|
||||
QStringList tmp_dep = Project->project->values(extraCompilerName + ".depends");
|
||||
QString tmp_dep_cmd = Project->project->values(extraCompilerName + ".depend_command").join(" ");
|
||||
QStringList configs = Project->project->values(extraCompilerName + ".CONFIG");
|
||||
bool combined = configs.indexOf("combine") != -1;
|
||||
|
||||
QString cmd, cmd_name, out;
|
||||
@ -2248,9 +2248,9 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
|
||||
// Command for file
|
||||
if (combined) {
|
||||
// Add dependencies for each file
|
||||
QStringList tmp_in = Project->project->variables()[extraCompilerName + ".input"];
|
||||
QStringList tmp_in = Project->project->values(extraCompilerName + ".input");
|
||||
for (int a = 0; a < tmp_in.count(); ++a) {
|
||||
const QStringList &files = Project->project->variables()[tmp_in.at(a)];
|
||||
const QStringList &files = Project->project->values(tmp_in.at(a));
|
||||
for (int b = 0; b < files.count(); ++b) {
|
||||
deps += Project->findDependencies(files.at(b));
|
||||
inputs += Option::fixPathToTargetOS(files.at(b), false);
|
||||
|
@ -379,12 +379,12 @@ QUuid VcprojGenerator::increaseUUID(const QUuid &id)
|
||||
QStringList VcprojGenerator::collectSubDirs(QMakeProject *proj)
|
||||
{
|
||||
QStringList subdirs;
|
||||
QStringList tmp_proj_subdirs = proj->variables()["SUBDIRS"];
|
||||
QStringList tmp_proj_subdirs = proj->values("SUBDIRS");
|
||||
for(int x = 0; x < tmp_proj_subdirs.size(); ++x) {
|
||||
QString tmpdir = tmp_proj_subdirs.at(x);
|
||||
const QString tmpdirConfig = tmpdir + QStringLiteral(".CONFIG");
|
||||
if (!proj->isEmpty(tmpdirConfig)) {
|
||||
const QStringList config = proj->variables().value(tmpdirConfig);
|
||||
const QStringList config = proj->values(tmpdirConfig);
|
||||
if (config.contains(QStringLiteral("no_default_target")))
|
||||
continue; // Ignore this sub-dir
|
||||
}
|
||||
@ -463,7 +463,7 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
|
||||
}
|
||||
if(tmp_proj.read(fn)) {
|
||||
// Check if all requirements are fulfilled
|
||||
if(!tmp_proj.variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) {
|
||||
if (!tmp_proj.isEmpty("QMAKE_FAILED_REQUIREMENTS")) {
|
||||
fprintf(stderr, "Project file(%s) not added to Solution because all requirements not met:\n\t%s\n",
|
||||
fn.toLatin1().constData(), tmp_proj.values("QMAKE_FAILED_REQUIREMENTS").join(" ").toLatin1().constData());
|
||||
continue;
|
||||
@ -536,17 +536,17 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
|
||||
newDep->target = newDep->target.left(newDep->target.length()-3) + "lib";
|
||||
|
||||
// All ActiveQt Server projects are dependent on idc.exe
|
||||
if(tmp_proj.variables()["CONFIG"].contains("qaxserver"))
|
||||
if (tmp_proj.values("CONFIG").contains("qaxserver"))
|
||||
newDep->dependencies << "idc.exe";
|
||||
|
||||
// All extra compilers which has valid input are considered dependencies
|
||||
const QStringList &quc = tmp_proj.variables()["QMAKE_EXTRA_COMPILERS"];
|
||||
const QStringList &quc = tmp_proj.values("QMAKE_EXTRA_COMPILERS");
|
||||
for(QStringList::ConstIterator it = quc.constBegin(); it != quc.constEnd(); ++it) {
|
||||
const QStringList &invar = tmp_proj.variables().value((*it) + ".input");
|
||||
const QStringList &invar = tmp_proj.values(*it + ".input");
|
||||
for(QStringList::ConstIterator iit = invar.constBegin(); iit != invar.constEnd(); ++iit) {
|
||||
const QStringList fileList = tmp_proj.variables().value(*iit);
|
||||
const QStringList fileList = tmp_proj.values(*iit);
|
||||
if (!fileList.isEmpty()) {
|
||||
const QStringList &cmdsParts = tmp_proj.variables().value((*it) + ".commands");
|
||||
const QStringList &cmdsParts = tmp_proj.values(*it + ".commands");
|
||||
bool startOfLine = true;
|
||||
foreach(QString cmd, cmdsParts) {
|
||||
if (!startOfLine) {
|
||||
@ -575,11 +575,11 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
|
||||
// Add all unknown libs to the deps
|
||||
QStringList where = QStringList() << "QMAKE_LIBS" << "QMAKE_LIBS_PRIVATE";
|
||||
if(!tmp_proj.isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
|
||||
where = tmp_proj.variables()["QMAKE_INTERNAL_PRL_LIBS"];
|
||||
for(QStringList::iterator wit = where.begin();
|
||||
where = tmp_proj.values("QMAKE_INTERNAL_PRL_LIBS");
|
||||
for (QStringList::ConstIterator wit = where.begin();
|
||||
wit != where.end(); ++wit) {
|
||||
QStringList &l = tmp_proj.variables()[(*wit)];
|
||||
for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
|
||||
const QStringList &l = tmp_proj.values(*wit);
|
||||
for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
|
||||
QString opt = (*it);
|
||||
if(!opt.startsWith("/") && // Not a switch
|
||||
opt != newDep->target && // Not self
|
||||
@ -767,10 +767,10 @@ void VcprojGenerator::init()
|
||||
// unless the compiler is configure as a combined stage, then use the first one
|
||||
const QStringList &quc = project->values("QMAKE_EXTRA_COMPILERS");
|
||||
for(QStringList::ConstIterator it = quc.constBegin(); it != quc.constEnd(); ++it) {
|
||||
const QStringList &invar = project->variables().value((*it) + ".input");
|
||||
const QStringList &invar = project->values(*it + ".input");
|
||||
const QString compiler_out = project->first((*it) + ".output");
|
||||
for(QStringList::ConstIterator iit = invar.constBegin(); iit != invar.constEnd(); ++iit) {
|
||||
QStringList fileList = project->variables().value(*iit);
|
||||
QStringList fileList = project->values(*iit);
|
||||
if (!fileList.isEmpty()) {
|
||||
if (project->values((*it) + ".CONFIG").indexOf("combine") != -1)
|
||||
fileList = QStringList(fileList.first());
|
||||
|
@ -557,9 +557,9 @@ void Option::prepareProject(const QString &pfile)
|
||||
|
||||
bool Option::postProcessProject(QMakeProject *project)
|
||||
{
|
||||
Option::cpp_ext = project->variables()["QMAKE_EXT_CPP"];
|
||||
Option::h_ext = project->variables()["QMAKE_EXT_H"];
|
||||
Option::c_ext = project->variables()["QMAKE_EXT_C"];
|
||||
Option::cpp_ext = project->values("QMAKE_EXT_CPP");
|
||||
Option::h_ext = project->values("QMAKE_EXT_H");
|
||||
Option::c_ext = project->values("QMAKE_EXT_C");
|
||||
Option::res_ext = project->first("QMAKE_EXT_RES");
|
||||
Option::pkgcfg_ext = project->first("QMAKE_EXT_PKGCONFIG");
|
||||
Option::libtool_ext = project->first("QMAKE_EXT_LIBTOOL");
|
||||
@ -573,7 +573,7 @@ bool Option::postProcessProject(QMakeProject *project)
|
||||
Option::lex_mod = project->first("QMAKE_MOD_LEX");
|
||||
Option::yacc_mod = project->first("QMAKE_MOD_YACC");
|
||||
Option::dir_sep = project->first("QMAKE_DIR_SEP");
|
||||
Option::shellPath = project->variables()["QMAKE_SH"];
|
||||
Option::shellPath = project->values("QMAKE_SH");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user