qmljs: add explicit -relocatable flag to qmlplugindumper and use it

This will allow changing the default to nonrelocatable.

Change-Id: I80746a3e70f94040a407cc25cec9ad6fac8b6fec
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Fawzi Mohamed
2013-04-24 12:21:21 +02:00
parent e793779589
commit eac15b5e7d
7 changed files with 23 additions and 4 deletions

View File

@@ -460,7 +460,7 @@ void sigSegvHandler(int) {
void printUsage(const QString &appName) void printUsage(const QString &appName)
{ {
qWarning() << qPrintable(QString( qWarning() << qPrintable(QString(
"Usage: %1 [-v] [-notrelocatable] module.uri version [module/import/path]\n" "Usage: %1 [-v] [-[non]relocatable] module.uri version [module/import/path]\n"
" %1 [-v] -path path/to/qmldir/directory [version]\n" " %1 [-v] -path path/to/qmldir/directory [version]\n"
" %1 [-v] -builtins\n" " %1 [-v] -builtins\n"
"Example: %1 Qt.labs.particles 4.7 /home/user/dev/qt-install/imports").arg( "Example: %1 Qt.labs.particles 4.7 /home/user/dev/qt-install/imports").arg(
@@ -507,8 +507,13 @@ int main(int argc, char *argv[])
} }
if (arg == QLatin1String("--notrelocatable") if (arg == QLatin1String("--notrelocatable")
|| arg == QLatin1String("-notrelocatable")) { || arg == QLatin1String("-notrelocatable")
|| arg == QLatin1String("--nonrelocatable")
|| arg == QLatin1String("-nonrelocatable")) {
relocatable = false; relocatable = false;
} else if (arg == QLatin1String("--relocatable")
|| arg == QLatin1String("-relocatable")) {
relocatable = true;
} else if (arg == QLatin1String("--path") } else if (arg == QLatin1String("--path")
|| arg == QLatin1String("-path")) { || arg == QLatin1String("-path")) {
action = Path; action = Path;

View File

@@ -57,12 +57,12 @@ public:
{ {
public: public:
ProjectInfo() ProjectInfo()
: tryQmlDump(false) : tryQmlDump(false), qmlDumpHasRelocatableFlag(true)
{ } { }
ProjectInfo(QPointer<ProjectExplorer::Project> project) ProjectInfo(QPointer<ProjectExplorer::Project> project)
: project(project) : project(project)
, tryQmlDump(false) , tryQmlDump(false), qmlDumpHasRelocatableFlag(true)
{ } { }
operator bool() const operator bool() const
@@ -83,6 +83,7 @@ public:
// whether trying to run qmldump makes sense // whether trying to run qmldump makes sense
bool tryQmlDump; bool tryQmlDump;
bool qmlDumpHasRelocatableFlag;
QString qmlDumpPath; QString qmlDumpPath;
::Utils::Environment qmlDumpEnvironment; ::Utils::Environment qmlDumpEnvironment;

View File

@@ -135,9 +135,11 @@ ModelManagerInterface::ProjectInfo QmlJSTools::defaultProjectInfoForProject(
toolChain, toolChain,
preferDebugDump, &projectInfo.qmlDumpPath, preferDebugDump, &projectInfo.qmlDumpPath,
&projectInfo.qmlDumpEnvironment); &projectInfo.qmlDumpEnvironment);
projectInfo.qmlDumpHasRelocatableFlag = qtVersion->hasQmlDumpWithRelocatableFlag();
} else { } else {
projectInfo.qmlDumpPath.clear(); projectInfo.qmlDumpPath.clear();
projectInfo.qmlDumpEnvironment.clear(); projectInfo.qmlDumpEnvironment.clear();
projectInfo.qmlDumpHasRelocatableFlag = true;
} }
setupProjectInfoQmlBundles(projectInfo); setupProjectInfoQmlBundles(projectInfo);
return projectInfo; return projectInfo;

View File

@@ -433,6 +433,8 @@ void PluginDumper::dump(const Plugin &plugin)
if (ComponentVersion(plugin.importVersion).isValid()) if (ComponentVersion(plugin.importVersion).isValid())
args << plugin.importVersion; args << plugin.importVersion;
} else { } else {
if (info.qmlDumpHasRelocatableFlag)
args << QLatin1String("-relocatable");
args << plugin.importUri; args << plugin.importUri;
args << plugin.importVersion; args << plugin.importVersion;
args << plugin.importPath; args << plugin.importPath;

View File

@@ -1097,6 +1097,13 @@ bool BaseQtVersion::hasQmlDump() const
return m_hasQmlDump; return m_hasQmlDump;
} }
bool BaseQtVersion::hasQmlDumpWithRelocatableFlag() const
{
updateVersionInfo();
return ((qtVersion() > QtVersionNumber(4, 8, 4) && qtVersion() < QtVersionNumber(5, 0, 0))
|| qtVersion() >= QtVersionNumber(5, 1, 0));
}
bool BaseQtVersion::needsQmlDump() const bool BaseQtVersion::needsQmlDump() const
{ {
updateVersionInfo(); updateVersionInfo();

View File

@@ -200,6 +200,7 @@ public:
virtual bool hasGdbDebuggingHelper() const; virtual bool hasGdbDebuggingHelper() const;
virtual bool hasQmlDump() const; virtual bool hasQmlDump() const;
virtual bool hasQmlDumpWithRelocatableFlag() const;
virtual bool needsQmlDump() const; virtual bool needsQmlDump() const;
virtual bool hasQmlDebuggingLibrary() const; virtual bool hasQmlDebuggingLibrary() const;
virtual bool needsQmlDebuggingLibrary() const; virtual bool needsQmlDebuggingLibrary() const;

View File

@@ -137,6 +137,7 @@ private slots:
if (projectInfo.qmlDumpPath.isEmpty()) if (projectInfo.qmlDumpPath.isEmpty())
projectInfo.qmlDumpPath = version->qmlDumpTool(!update.preferDebug); projectInfo.qmlDumpPath = version->qmlDumpTool(!update.preferDebug);
projectInfo.qmlDumpEnvironment = version->qmlToolsEnvironment(); projectInfo.qmlDumpEnvironment = version->qmlToolsEnvironment();
projectInfo.qmlDumpHasRelocatableFlag = version->hasQmlDumpWithRelocatableFlag();
modelManager->updateProjectInfo(projectInfo); modelManager->updateProjectInfo(projectInfo);
} }