Commit 62117ee2 authored by jkobus's avatar jkobus Committed by Kai Koehne

Fix deployment for QtQuick templates

Task-number: QTCREATORBUG-11412

Change-Id: Iee117faaf85fcaa3e216091a8f7d95b4e12237cb
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent d602a942
...@@ -10,3 +10,5 @@ RESOURCES += qml.qrc ...@@ -10,3 +10,5 @@ RESOURCES += qml.qrc
# QML_IMPORT_PATH # # QML_IMPORT_PATH #
QML_IMPORT_PATH = QML_IMPORT_PATH =
# Default rules for deployment.
include(../../shared/qrcdeployment.pri)
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="C" <template openeditor="main.qml" priority="C"
featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2" featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2"
qrcdeployment="qrcdeployment.pri"
stubversionminor="5"> stubversionminor="5">
<displayname>Qt Quick 2.1</displayname> <displayname>Qt Quick 2.1</displayname>
<description>Creates a deployable Qt Quick 2 application using the QtQuick 2.1 import. Requires Qt 5.1 or newer.</description> <description>Creates a deployable Qt Quick 2 application using the QtQuick 2.1 import. Requires Qt 5.1 or newer.</description>
......
...@@ -10,3 +10,5 @@ RESOURCES += qml.qrc ...@@ -10,3 +10,5 @@ RESOURCES += qml.qrc
# QML_IMPORT_PATH # # QML_IMPORT_PATH #
QML_IMPORT_PATH = QML_IMPORT_PATH =
# Default rules for deployment.
include(../../shared/qrcdeployment.pri)
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="A" <template openeditor="main.qml" priority="A"
featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2" featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2"
qrcdeployment="qrcdeployment.pri"
stubversionminor="5"> stubversionminor="5">
<displayname>Qt Quick 2.2</displayname> <displayname>Qt Quick 2.2</displayname>
<description>Creates a deployable Qt Quick 2 application using the QtQuick 2.2 import. Requires Qt 5.2 or newer.</description> <description>Creates a deployable Qt Quick 2 application using the QtQuick 2.2 import. Requires Qt 5.2 or newer.</description>
......
...@@ -8,3 +8,6 @@ RESOURCES += qml.qrc ...@@ -8,3 +8,6 @@ RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model # Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH = QML_IMPORT_PATH =
# Default rules for deployment.
include(../../shared/qrcdeployment.pri)
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="D" <template openeditor="main.qml" priority="D"
featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2, QtSupport.Wizards.FeatureQtQuick.Controls" featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2, QtSupport.Wizards.FeatureQtQuick.Controls"
viewerdir="qtquick2controlsapplicationviewer" qrcdeployment="qrcdeployment.pri"
viewerclassname="QtQuick2ControlsApplicationViewer"
stubversionminor="1"> stubversionminor="1">
<displayname>Qt Quick Controls 1.0</displayname> <displayname>Qt Quick Controls 1.0</displayname>
<description>Creates a deployable Qt Quick 2 application using Qt Quick Controls. Requires Qt 5.1 or newer.</description> <description>Creates a deployable Qt Quick 2 application using Qt Quick Controls. Requires Qt 5.1 or newer.</description>
......
...@@ -8,3 +8,6 @@ RESOURCES += qml.qrc ...@@ -8,3 +8,6 @@ RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model # Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH = QML_IMPORT_PATH =
# Default rules for deployment.
include(../../shared/qrcdeployment.pri)
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="B" <template openeditor="main.qml" priority="B"
featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2, QtSupport.Wizards.FeatureQtQuick.Controls" featuresRequired="QtSupport.Wizards.FeatureQtQuick, QtSupport.Wizards.FeatureQtQuick.2, QtSupport.Wizards.FeatureQtQuick.Controls"
viewerdir="qtquick2controlsapplicationviewer" qrcdeployment="qrcdeployment.pri"
viewerclassname="QtQuick2ControlsApplicationViewer"
stubversionminor="1"> stubversionminor="1">
<displayname>Qt Quick Controls 1.1</displayname> <displayname>Qt Quick Controls 1.1</displayname>
<description>Creates a deployable Qt Quick 2 application using Qt Quick Controls. Requires Qt 5.2 or newer.</description> <description>Creates a deployable Qt Quick 2 application using Qt Quick Controls. Requires Qt 5.2 or newer.</description>
......
android-no-sdk {
target.path = /data/user/qt
export(target.path)
INSTALLS += target
} else:android {
x86 {
target.path = /libs/x86
} else: armeabi-v7a {
target.path = /libs/armeabi-v7a
} else {
target.path = /libs/armeabi
}
export(target.path)
INSTALLS += target
} else:unix {
isEmpty(target.path) {
target.path = /opt/$${TARGET}/bin
export(target.path)
}
INSTALLS += target
}
export(INSTALLS)
...@@ -44,9 +44,14 @@ ...@@ -44,9 +44,14 @@
namespace QmakeProjectManager { namespace QmakeProjectManager {
namespace Internal { namespace Internal {
static QString sharedDirectory()
{
return Core::ICore::resourcePath() + QLatin1String("/templates/shared/");
}
static QString qtQuickApplicationViewerDirectory() static QString qtQuickApplicationViewerDirectory()
{ {
return Core::ICore::resourcePath() + QLatin1String("/templates/shared/qtquickapplicationviewer/"); return sharedDirectory() + QLatin1String("qtquickapplicationviewer/");
} }
static QString templateRootDirectory() static QString templateRootDirectory()
...@@ -112,6 +117,7 @@ static bool parseTemplateXml(QXmlStreamReader &reader, TemplateInfo *info) ...@@ -112,6 +117,7 @@ static bool parseTemplateXml(QXmlStreamReader &reader, TemplateInfo *info)
static const QLatin1String attribute_priority("priority"); static const QLatin1String attribute_priority("priority");
static const QLatin1String attribute_viewerdir("viewerdir"); static const QLatin1String attribute_viewerdir("viewerdir");
static const QLatin1String attribute_viewerclassname("viewerclassname"); static const QLatin1String attribute_viewerclassname("viewerclassname");
static const QLatin1String attribute_qrcdeployment("qrcdeployment");
static const QLatin1String attribute_stubversionminor("stubversionminor"); static const QLatin1String attribute_stubversionminor("stubversionminor");
while (!reader.atEnd() && !reader.hasError()) { while (!reader.atEnd() && !reader.hasError()) {
...@@ -133,6 +139,9 @@ static bool parseTemplateXml(QXmlStreamReader &reader, TemplateInfo *info) ...@@ -133,6 +139,9 @@ static bool parseTemplateXml(QXmlStreamReader &reader, TemplateInfo *info)
if (reader.attributes().hasAttribute(attribute_viewerclassname)) if (reader.attributes().hasAttribute(attribute_viewerclassname))
info->viewerClassName = reader.attributes().value(attribute_viewerclassname).toString(); info->viewerClassName = reader.attributes().value(attribute_viewerclassname).toString();
if (reader.attributes().hasAttribute(attribute_qrcdeployment))
info->qrcDeployment = reader.attributes().value(attribute_qrcdeployment).toString();
if (reader.attributes().hasAttribute(attribute_stubversionminor)) if (reader.attributes().hasAttribute(attribute_stubversionminor))
info->stubVersionMinor = reader.attributes().value(attribute_stubversionminor).toString().toInt(); info->stubVersionMinor = reader.attributes().value(attribute_stubversionminor).toString().toInt();
...@@ -205,6 +214,8 @@ QString QtQuickApp::pathExtended(int fileType) const ...@@ -205,6 +214,8 @@ QString QtQuickApp::pathExtended(int fileType) const
const QString mainQmlFile = QLatin1String("main.qml"); const QString mainQmlFile = QLatin1String("main.qml");
const QString mainQrcFile = QLatin1String("qml.qrc"); const QString mainQrcFile = QLatin1String("qml.qrc");
const QString qrcDeploymentFile = QLatin1String("deployment.pri");
const QString qmlOriginDir = originsRoot() + QLatin1String("qml/"); const QString qmlOriginDir = originsRoot() + QLatin1String("qml/");
const QString pathBase = outputPathBase(); const QString pathBase = outputPathBase();
...@@ -215,6 +226,8 @@ QString QtQuickApp::pathExtended(int fileType) const ...@@ -215,6 +226,8 @@ QString QtQuickApp::pathExtended(int fileType) const
case MainQmlOrigin: return qmlOriginDir + mainQmlFile; case MainQmlOrigin: return qmlOriginDir + mainQmlFile;
case MainQrc: return pathBase + mainQrcFile; case MainQrc: return pathBase + mainQrcFile;
case MainQrcOrigin: return originsRoot() + mainQrcFile; case MainQrcOrigin: return originsRoot() + mainQrcFile;
case QrcDeployment: return pathBase + qrcDeploymentFile;
case QrcDeploymentOrigin: return sharedDirectory() + qrcDeployment();
case AppViewerPri: return pathBase + appViewerTargetSubDir + fileName(AppViewerPri); case AppViewerPri: return pathBase + appViewerTargetSubDir + fileName(AppViewerPri);
case AppViewerPriOrigin: return qtQuickApplicationViewerDirectory() + appViewerOriginSubDir() + fileName(AppViewerPri); case AppViewerPriOrigin: return qtQuickApplicationViewerDirectory() + appViewerOriginSubDir() + fileName(AppViewerPri);
case AppViewerCpp: return pathBase + appViewerTargetSubDir + fileName(AppViewerCpp); case AppViewerCpp: return pathBase + appViewerTargetSubDir + fileName(AppViewerCpp);
...@@ -271,6 +284,9 @@ Core::GeneratedFiles QtQuickApp::generateFiles(QString *errorMessage) const ...@@ -271,6 +284,9 @@ Core::GeneratedFiles QtQuickApp::generateFiles(QString *errorMessage) const
if (QFileInfo(path(MainQrcOrigin)).exists()) { if (QFileInfo(path(MainQrcOrigin)).exists()) {
files.append(file(generateFile(QtQuickAppGeneratedFileInfo::MainQrcFile, errorMessage), path(MainQrc))); files.append(file(generateFile(QtQuickAppGeneratedFileInfo::MainQrcFile, errorMessage), path(MainQrc)));
} }
if (!qrcDeployment().isEmpty()) {
files.append(file(generateFile(QtQuickAppGeneratedFileInfo::QrcDeploymentFile, errorMessage), path(QrcDeployment)));
}
if (!appViewerBaseName().isEmpty()) { if (!appViewerBaseName().isEmpty()) {
files.append(file(generateFile(QtQuickAppGeneratedFileInfo::AppViewerPriFile, errorMessage), path(AppViewerPri))); files.append(file(generateFile(QtQuickAppGeneratedFileInfo::AppViewerPriFile, errorMessage), path(AppViewerPri)));
files.append(file(generateFile(QtQuickAppGeneratedFileInfo::AppViewerCppFile, errorMessage), path(AppViewerCpp))); files.append(file(generateFile(QtQuickAppGeneratedFileInfo::AppViewerCppFile, errorMessage), path(AppViewerCpp)));
...@@ -291,6 +307,11 @@ QString QtQuickApp::appViewerBaseName() const ...@@ -291,6 +307,11 @@ QString QtQuickApp::appViewerBaseName() const
return m_templateInfo.viewerDir; return m_templateInfo.viewerDir;
} }
QString QtQuickApp::qrcDeployment() const
{
return m_templateInfo.qrcDeployment;
}
QString QtQuickApp::fileName(QtQuickApp::ExtendedFileType type) const QString QtQuickApp::fileName(QtQuickApp::ExtendedFileType type) const
{ {
switch (type) { switch (type) {
...@@ -310,6 +331,7 @@ QByteArray QtQuickApp::generateProFile(QString *errorMessage) const ...@@ -310,6 +331,7 @@ QByteArray QtQuickApp::generateProFile(QString *errorMessage) const
{ {
QByteArray proFileContent = AbstractMobileApp::generateProFile(errorMessage); QByteArray proFileContent = AbstractMobileApp::generateProFile(errorMessage);
proFileContent.replace("../../shared/qtquickapplicationviewer/", ""); proFileContent.replace("../../shared/qtquickapplicationviewer/", "");
proFileContent.replace("../../shared/qrc", ""); // fix a path to qrcdeployment.pri
return proFileContent; return proFileContent;
} }
...@@ -324,6 +346,9 @@ QByteArray QtQuickApp::generateFileExtended(int fileType, ...@@ -324,6 +346,9 @@ QByteArray QtQuickApp::generateFileExtended(int fileType,
case QtQuickAppGeneratedFileInfo::MainQrcFile: case QtQuickAppGeneratedFileInfo::MainQrcFile:
data = readBlob(path(MainQrcOrigin), errorMessage); data = readBlob(path(MainQrcOrigin), errorMessage);
break; break;
case QtQuickAppGeneratedFileInfo::QrcDeploymentFile:
data = readBlob(path(QrcDeploymentOrigin), errorMessage);
break;
case QtQuickAppGeneratedFileInfo::AppViewerPriFile: case QtQuickAppGeneratedFileInfo::AppViewerPriFile:
data = readBlob(path(AppViewerPriOrigin), errorMessage); data = readBlob(path(AppViewerPriOrigin), errorMessage);
data.append(readBlob(path(DeploymentPriOrigin), errorMessage)); data.append(readBlob(path(DeploymentPriOrigin), errorMessage));
......
...@@ -42,7 +42,8 @@ struct QtQuickAppGeneratedFileInfo : public AbstractGeneratedFileInfo ...@@ -42,7 +42,8 @@ struct QtQuickAppGeneratedFileInfo : public AbstractGeneratedFileInfo
MainQrcFile, MainQrcFile,
AppViewerPriFile, AppViewerPriFile,
AppViewerCppFile, AppViewerCppFile,
AppViewerHFile AppViewerHFile,
QrcDeploymentFile
}; };
QtQuickAppGeneratedFileInfo() : AbstractGeneratedFileInfo() {} QtQuickAppGeneratedFileInfo() : AbstractGeneratedFileInfo() {}
...@@ -61,6 +62,7 @@ public: ...@@ -61,6 +62,7 @@ public:
QString priority; QString priority;
QString viewerClassName; QString viewerClassName;
QString viewerDir; QString viewerDir;
QString qrcDeployment;
int stubVersionMinor; int stubVersionMinor;
}; };
...@@ -79,7 +81,9 @@ public: ...@@ -79,7 +81,9 @@ public:
AppViewerCppOrigin, AppViewerCppOrigin,
AppViewerH, AppViewerH,
AppViewerHOrigin, AppViewerHOrigin,
QmlDirProFileRelative QmlDirProFileRelative,
QrcDeployment,
QrcDeploymentOrigin
}; };
QtQuickApp(); QtQuickApp();
...@@ -101,6 +105,7 @@ protected: ...@@ -101,6 +105,7 @@ protected:
virtual QByteArray generateProFile(QString *errorMessage) const; virtual QByteArray generateProFile(QString *errorMessage) const;
QString appViewerBaseName() const; QString appViewerBaseName() const;
QString qrcDeployment() const;
QString fileName(ExtendedFileType type) const; QString fileName(ExtendedFileType type) const;
QString appViewerOriginSubDir() const; QString appViewerOriginSubDir() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment