clean up build pass project initialization
instead of messing with the Option singleton, add a way to inject extra config values into QMakeProject. Change-Id: Ia347dcc38af2c72913e30ebf5c2b4044f93b4f5f Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com> Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
This commit is contained in:
parent
74a6669fa7
commit
93ee903da7
@ -238,25 +238,21 @@ MakefileGenerator
|
|||||||
|
|
||||||
//initialize the base
|
//initialize the base
|
||||||
QHash<QString, QStringList> basevars;
|
QHash<QString, QStringList> basevars;
|
||||||
|
QStringList basecfgs;
|
||||||
if(!project->isEmpty(build + ".CONFIG"))
|
if(!project->isEmpty(build + ".CONFIG"))
|
||||||
basevars["CONFIG"] += project->values(build + ".CONFIG");
|
basecfgs = project->values(build + ".CONFIG");
|
||||||
basevars["CONFIG"] += build;
|
basecfgs += build;
|
||||||
basevars["CONFIG"] += "build_pass";
|
basecfgs += "build_pass";
|
||||||
|
basevars["CONFIG"] = basecfgs;
|
||||||
basevars["BUILD_PASS"] = QStringList(build);
|
basevars["BUILD_PASS"] = QStringList(build);
|
||||||
QStringList buildname = project->values(build + ".name");
|
QStringList buildname = project->values(build + ".name");
|
||||||
basevars["BUILD_NAME"] = (buildname.isEmpty() ? QStringList(build) : buildname);
|
basevars["BUILD_NAME"] = (buildname.isEmpty() ? QStringList(build) : buildname);
|
||||||
|
|
||||||
//create project
|
//create project
|
||||||
QMakeProject *build_proj = new QMakeProject(project->properties(), basevars);
|
QMakeProject *build_proj = new QMakeProject(project->properties(), basevars);
|
||||||
|
build_proj->setExtraConfigs(basecfgs);
|
||||||
|
|
||||||
//all the user configs must be set again afterwards (for .pro tests and for .prf tests)
|
|
||||||
const QStringList old_after_user_config = Option::after_user_configs;
|
|
||||||
const QStringList old_user_config = Option::user_configs;
|
|
||||||
Option::after_user_configs += basevars["CONFIG"];
|
|
||||||
Option::user_configs += basevars["CONFIG"];
|
|
||||||
build_proj->read(project->projectFile());
|
build_proj->read(project->projectFile());
|
||||||
Option::after_user_configs = old_after_user_config;
|
|
||||||
Option::user_configs = old_user_config;
|
|
||||||
|
|
||||||
//done
|
//done
|
||||||
return createMakefileGenerator(build_proj);
|
return createMakefileGenerator(build_proj);
|
||||||
|
@ -92,7 +92,6 @@ Option::QMAKE_RECURSIVE Option::recursive = Option::QMAKE_RECURSIVE_DEFAULT;
|
|||||||
QStringList Option::before_user_vars;
|
QStringList Option::before_user_vars;
|
||||||
QStringList Option::after_user_vars;
|
QStringList Option::after_user_vars;
|
||||||
QStringList Option::user_configs;
|
QStringList Option::user_configs;
|
||||||
QStringList Option::after_user_configs;
|
|
||||||
QString Option::user_template;
|
QString Option::user_template;
|
||||||
QString Option::user_template_prefix;
|
QString Option::user_template_prefix;
|
||||||
QStringList Option::shellPath;
|
QStringList Option::shellPath;
|
||||||
|
@ -173,7 +173,7 @@ struct Option
|
|||||||
static int warn_level;
|
static int warn_level;
|
||||||
enum QMAKE_RECURSIVE { QMAKE_RECURSIVE_DEFAULT, QMAKE_RECURSIVE_YES, QMAKE_RECURSIVE_NO };
|
enum QMAKE_RECURSIVE { QMAKE_RECURSIVE_DEFAULT, QMAKE_RECURSIVE_YES, QMAKE_RECURSIVE_NO };
|
||||||
static QMAKE_RECURSIVE recursive;
|
static QMAKE_RECURSIVE recursive;
|
||||||
static QStringList before_user_vars, after_user_vars, user_configs, after_user_configs;
|
static QStringList before_user_vars, after_user_vars, user_configs;
|
||||||
enum HOST_MODE { HOST_UNKNOWN_MODE, HOST_UNIX_MODE, HOST_WIN_MODE, HOST_MACX_MODE };
|
enum HOST_MODE { HOST_UNKNOWN_MODE, HOST_UNIX_MODE, HOST_WIN_MODE, HOST_MACX_MODE };
|
||||||
static HOST_MODE host_mode;
|
static HOST_MODE host_mode;
|
||||||
enum TARG_MODE { TARG_UNKNOWN_MODE, TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE,
|
enum TARG_MODE { TARG_UNKNOWN_MODE, TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE,
|
||||||
|
@ -1326,6 +1326,14 @@ QMakeProject::read(uchar cmd)
|
|||||||
parse("CONFIG += " + Option::user_configs.join(" "), vars);
|
parse("CONFIG += " + Option::user_configs.join(" "), vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// After user configs, to override them
|
||||||
|
if (!extra_configs.isEmpty()) {
|
||||||
|
parser.file = "(extra configs)";
|
||||||
|
parser.from_file = false;
|
||||||
|
parser.line_no = 1; //really arg count now.. duh
|
||||||
|
parse("CONFIG += " + extra_configs.join(" "), vars);
|
||||||
|
}
|
||||||
|
|
||||||
if(cmd & ReadProFile) { // parse project file
|
if(cmd & ReadProFile) { // parse project file
|
||||||
debug_msg(1, "Project file: reading %s", pfile.toLatin1().constData());
|
debug_msg(1, "Project file: reading %s", pfile.toLatin1().constData());
|
||||||
if(pfile != "-" && !QFile::exists(pfile) && !pfile.endsWith(Option::pro_ext))
|
if(pfile != "-" && !QFile::exists(pfile) && !pfile.endsWith(Option::pro_ext))
|
||||||
@ -1349,12 +1357,14 @@ QMakeProject::read(uchar cmd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//after configs (set in BUILDS)
|
// Again, to ensure the project does not mess with us.
|
||||||
if ((cmd & ReadSetup) && !Option::after_user_configs.isEmpty()) {
|
// Specifically, do not allow a project to override debug/release within a
|
||||||
parser.file = "(configs)";
|
// debug_and_release build pass - it's too late for that at this point anyway.
|
||||||
|
if (!extra_configs.isEmpty()) {
|
||||||
|
parser.file = "(extra configs)";
|
||||||
parser.from_file = false;
|
parser.from_file = false;
|
||||||
parser.line_no = 1; //really arg count now.. duh
|
parser.line_no = 1; //really arg count now.. duh
|
||||||
parse("CONFIG += " + Option::after_user_configs.join(" "), vars);
|
parse("CONFIG += " + extra_configs.join(" "), vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cmd & ReadFeatures) {
|
if(cmd & ReadFeatures) {
|
||||||
|
@ -84,6 +84,7 @@ class QMakeProject
|
|||||||
QString pfile, cfile;
|
QString pfile, cfile;
|
||||||
QMakeProperty *prop;
|
QMakeProperty *prop;
|
||||||
void reset();
|
void reset();
|
||||||
|
QStringList extra_configs;
|
||||||
QHash<QString, QStringList> vars, base_vars;
|
QHash<QString, QStringList> vars, base_vars;
|
||||||
bool parse(const QString &text, QHash<QString, QStringList> &place, int line_count=1);
|
bool parse(const QString &text, QHash<QString, QStringList> &place, int line_count=1);
|
||||||
|
|
||||||
@ -118,6 +119,8 @@ public:
|
|||||||
QMakeProject(QMakeProperty *p, const QHash<QString, QStringList> &nvars) { init(p, &nvars); }
|
QMakeProject(QMakeProperty *p, const QHash<QString, QStringList> &nvars) { init(p, &nvars); }
|
||||||
~QMakeProject();
|
~QMakeProject();
|
||||||
|
|
||||||
|
void setExtraConfigs(const QStringList &_cfgs) { extra_configs = _cfgs; }
|
||||||
|
|
||||||
enum { ReadProFile=0x01, ReadSetup=0x02, ReadFeatures=0x04, ReadAll=0xFF };
|
enum { ReadProFile=0x01, ReadSetup=0x02, ReadFeatures=0x04, ReadAll=0xFF };
|
||||||
inline bool parse(const QString &text) { return parse(text, vars); }
|
inline bool parse(const QString &text) { return parse(text, vars); }
|
||||||
bool read(const QString &project, uchar cmd=ReadAll);
|
bool read(const QString &project, uchar cmd=ReadAll);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user