Commit f085cb22 authored by Christian Kandeler's avatar Christian Kandeler

qbs build: More steps toward creating a "development installation".

Namely:
    - Install header files.
    - Install imports and modules.
    - Create modules from products and install them.

This is most of what we need. The main thing still left to do is
dealing with paths in Export items. These have to be translated
somehow. (Currently we only copy the Depends items out of the
Export items and ignore everything else.)

Change-Id: I12d49fa31d1c1e05bc77a0e0ce3ec9c78c27192a
Reviewed-by: Joerg Bornemann's avatarJoerg Bornemann <joerg.bornemann@qt.io>
parent 44771d24
import qbs
QtcPlugin {
Depends { name: "LicenseChecker"; required: false }
cpp.defines: base.concat(LicenseChecker.present ? ["LICENSECHECKER"] : [])
}
import qbs
import qbs.FileInfo
Product {
property string productName: project.name
name: productName + " dev headers"
condition: qtc.make_dev_package
Depends { name: "qtc" }
Group {
files: ["**/*.h"]
qbs.install: true
qbs.installDir: qtc.ide_include_path + '/' + FileInfo.fileName(product.sourceDirectory)
qbs.installSourceBase: product.sourceDirectory
}
}
......@@ -2,8 +2,9 @@ import qbs 1.0
import QtcFunctions
QtcProduct {
type: ["dynamiclibrary", "dynamiclibrary_symlink"]
type: ["dynamiclibrary", "dynamiclibrary_symlink", "qtc.dev-module"]
installDir: qtc.ide_library_path
installTags: ["dynamiclibrary", "dynamiclibrary_symlink"]
Depends {
condition: qtc.testsEnabled
name: "Qt.test"
......
......@@ -3,8 +3,9 @@ import qbs.FileInfo
import QtcFunctions
QtcProduct {
type: ["dynamiclibrary", "pluginSpec"]
type: ["dynamiclibrary", "pluginSpec", "qtc.dev-module"]
installDir: qtc.ide_plugin_path
installTags: ["dynamiclibrary"]
property var pluginJsonReplacements
property var pluginRecommends: []
......
......@@ -2,12 +2,15 @@ import qbs 1.0
import QtcFunctions
Product {
name: project.name
version: qtc.qtcreator_version
property bool install: true
property string installDir
property stringList installTags: type
Depends { name: "cpp" }
Depends { name: "qtc" }
Depends { name: product.name + " dev headers"; required: false }
cpp.cxxLanguageVersion: "c++11"
cpp.defines: qtc.generalDefines
......@@ -24,8 +27,14 @@ Product {
Depends { name: "Qt.core" }
Group {
fileTagsFilter: product.type
fileTagsFilter: installTags
qbs.install: install
qbs.installDir: installDir
}
Group {
fileTagsFilter: ["qtc.dev-module"]
qbs.install: true
qbs.installDir: qtc.ide_qbs_modules_path + '/' + product.name
}
}
var File = loadExtension("qbs.File");
var FileInfo = loadExtension("qbs.FileInfo");
var TextFile = loadExtension("qbs.TextFile");
function getExportBlock(productFile)
{
var exportBlock = "";
var exportIndex = -1;
while (!productFile.atEof()) {
var line = productFile.readLine();
if (exportIndex === -1) {
exportIndex = line.indexOf("Export {");
continue;
}
if (line.indexOf('}') === exportIndex)
break;
exportBlock += line + '\n';
}
return exportBlock;
}
function getDependsItemsFromExportBlock(exportBlock)
{
var lines = exportBlock.split('\n');
var dependsItems = ["Depends { name: 'cpp' }"];
var dependsIndex = -1;
var currentDependsItem;
for (var i = 0; i < lines.length; ++i) {
var line = lines[i];
if (dependsIndex !== -1) {
currentDependsItem += line;
if (line.indexOf('}') === dependsIndex) {
dependsItems.push(currentDependsItem);
dependsIndex = -1;
}
continue;
}
dependsIndex = line.indexOf("Depends {");
if (dependsIndex === -1)
continue;
if (line.contains('}')) {
if (!dependsItems.contains("cpp"))
dependsItems.push(line);
dependsIndex = -1;
} else {
currentDependsItem = line;
}
}
return dependsItems;
}
function getDependsItems(product)
{
var productFilePath = FileInfo.joinPaths(product.sourceDirectory,
FileInfo.fileName(product.sourceDirectory) + ".qbs");
var productFile = new TextFile(productFilePath, TextFile.ReadOnly);
try {
var exportBlock = getExportBlock(productFile);
return getDependsItemsFromExportBlock(exportBlock);
} finally {
productFile.close();
}
}
function writeModuleFile(product, input, output, dependsItems)
{
var moduleFile = new TextFile(output.filePath, TextFile.WriteOnly);
try {
moduleFile.writeLine("import qbs");
moduleFile.writeLine("");
moduleFile.writeLine("Module {")
for (var i = 0; i < dependsItems.length; ++i) {
moduleFile.writeLine(" " + dependsItems[i].trim());
moduleFile.writeLine("");
}
var includePath = FileInfo.joinPaths("/",
product.moduleProperty("qtc", "ide_include_path"));
var modulePath = FileInfo.joinPaths("/",
product.moduleProperty("qtc", "ide_qbs_modules_path"), product.name);
var relPathToIncludes = FileInfo.relativePath(modulePath, includePath);
moduleFile.writeLine(" cpp.includePaths: [path + '/" + relPathToIncludes + "']");
var libInstallPath = FileInfo.joinPaths("/", input.moduleProperty("qbs", "installPrefix"),
input.moduleProperty("qbs", "installDir"));
var relPathToLibrary = FileInfo.relativePath(modulePath, libInstallPath);
var libType = input.fileTags.contains("dynamiclibrary") ? "dynamic" : "static";
moduleFile.writeLine(" cpp." + libType + "Libraries: [path + '/"
+ relPathToLibrary + "/" + input.fileName + "']");
moduleFile.writeLine("}");
} finally {
moduleFile.close();
}
}
import qbs
import qbs.Environment
import "qtc.js" as HelperFunctions
Module {
property string ide_version_major: '4'
......@@ -46,6 +47,12 @@ Module {
property string ide_doc_path: qbs.targetOS.contains("osx")
? ide_data_path + "/doc"
: "share/doc/qtcreator"
property string ide_include_path: "include"
property string ide_qbs_resources_path: "qbs-resources"
property string ide_qbs_modules_path: ide_qbs_resources_path + "/modules"
property string ide_qbs_imports_path: ide_qbs_resources_path + "/imports"
property bool make_dev_package: false
property bool testsEnabled: Environment.getEnv("TEST") || qbs.buildVariant === "debug"
property stringList generalDefines: [
......@@ -54,4 +61,22 @@ Module {
"QT_NO_CAST_TO_ASCII",
"QT_RESTRICTED_CAST_FROM_ASCII"
].concat(testsEnabled ? ["WITH_TESTS"] : [])
Rule {
condition: make_dev_package
inputs: ["dynamiclibrary", "staticlibrary"]
Artifact {
filePath: product.name + "-module.qbs"
fileTags: ["qtc.dev-module"]
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "Creating " + output.fileName;
cmd.sourceCode = function() {
var dependsItems = HelperFunctions.getDependsItems(product);
HelperFunctions.writeModuleFile(product, input, output, dependsItems);
};
return [cmd];
}
}
}
......@@ -23,6 +23,18 @@ Project {
"tests/tests.qbs"
]
Product {
name: "qbs_imports_modules"
Depends { name: "qtc" }
Group {
prefix: "qbs/"
files: ["**/*"]
qbs.install: qtc.make_dev_package
qbs.installDir: qtc.ide_qbs_resources_path
qbs.installSourceBase: "qbs"
}
}
AutotestRunner {
Depends { name: "Qt.core" }
Depends { name: "qtc" }
......
import qbs 1.0
QtcLibrary {
Project {
name: "Aggregation"
Depends { name: "Qt.core" }
cpp.defines: base.concat("AGGREGATION_LIBRARY")
QtcDevHeaders { }
files: [
"aggregate.cpp",
"aggregate.h",
"aggregation_global.h",
]
QtcLibrary {
Depends { name: "Qt.core" }
cpp.defines: base.concat("AGGREGATION_LIBRARY")
files: [
"aggregate.cpp",
"aggregate.h",
"aggregation_global.h",
]
}
}
import qbs 1.0
QtcLibrary {
Project {
name: "ExtensionSystem"
cpp.defines: base.concat([
"EXTENSIONSYSTEM_LIBRARY",
"IDE_TEST_DIR=\".\""
])
QtcDevHeaders { }
Depends { name: "Qt"; submodules: ["core", "widgets"] }
Depends { name: "Aggregation" }
Depends { name: "Utils" }
QtcLibrary {
cpp.defines: base.concat([
"EXTENSIONSYSTEM_LIBRARY",
"IDE_TEST_DIR=\".\""
])
files: [
"extensionsystem_global.h",
"invoker.cpp",
"invoker.h",
"iplugin.cpp",
"iplugin.h",
"iplugin_p.h",
"optionsparser.cpp",
"optionsparser.h",
"plugincollection.cpp",
"plugincollection.h",
"plugindetailsview.cpp",
"plugindetailsview.h",
"plugindetailsview.ui",
"pluginerroroverview.cpp",
"pluginerroroverview.h",
"pluginerroroverview.ui",
"pluginerrorview.cpp",
"pluginerrorview.h",
"pluginerrorview.ui",
"pluginmanager.cpp",
"pluginmanager.h",
"pluginmanager_p.h",
"pluginspec.cpp",
"pluginspec.h",
"pluginspec_p.h",
"pluginview.cpp",
"pluginview.h",
"pluginview.qrc",
"images/error.png",
"images/notloaded.png",
"images/ok.png",
]
Depends { name: "Qt"; submodules: ["core", "widgets"] }
Depends { name: "Aggregation" }
Depends { name: "Utils" }
Export {
Depends { name: "Qt.core" }
files: [
"extensionsystem_global.h",
"invoker.cpp",
"invoker.h",
"iplugin.cpp",
"iplugin.h",
"iplugin_p.h",
"optionsparser.cpp",
"optionsparser.h",
"plugincollection.cpp",
"plugincollection.h",
"plugindetailsview.cpp",
"plugindetailsview.h",
"plugindetailsview.ui",
"pluginerroroverview.cpp",
"pluginerroroverview.h",
"pluginerroroverview.ui",
"pluginerrorview.cpp",
"pluginerrorview.h",
"pluginerrorview.ui",
"pluginmanager.cpp",
"pluginmanager.h",
"pluginmanager_p.h",
"pluginspec.cpp",
"pluginspec.h",
"pluginspec_p.h",
"pluginview.cpp",
"pluginview.h",
"pluginview.qrc",
"images/error.png",
"images/notloaded.png",
"images/ok.png",
]
Export {
Depends { name: "Qt.core" }
}
}
}
import qbs 1.0
QtcLibrary {
Project {
name: "QmlDebug"
cpp.defines: base.concat("QMLDEBUG_LIB")
QtcDevHeaders { }
Depends { name: "Qt"; submodules: ["gui", "network"] }
Depends { name: "Utils" }
QtcLibrary {
cpp.defines: base.concat("QMLDEBUG_LIB")
files: [
"baseenginedebugclient.cpp",
"baseenginedebugclient.h",
"basetoolsclient.cpp",
"basetoolsclient.h",
"declarativeenginedebugclient.cpp",
"declarativeenginedebugclient.h",
"declarativeenginedebugclientv2.h",
"declarativetoolsclient.cpp",
"declarativetoolsclient.h",
"qdebugmessageclient.cpp",
"qdebugmessageclient.h",
"qmldebug_global.h",
"qmldebugclient.cpp",
"qmldebugclient.h",
"qmldebugcommandlinearguments.h",
"qmldebugconstants.h",
"qmlenginecontrolclient.cpp",
"qmlenginecontrolclient.h",
"qmlenginedebugclient.h",
"qmloutputparser.cpp",
"qmloutputparser.h",
"qmltoolsclient.cpp",
"qmltoolsclient.h",
"qpacketprotocol.cpp",
"qpacketprotocol.h",
]
}
Depends { name: "Qt"; submodules: ["gui", "network"] }
Depends { name: "Utils" }
files: [
"baseenginedebugclient.cpp",
"baseenginedebugclient.h",
"basetoolsclient.cpp",
"basetoolsclient.h",
"declarativeenginedebugclient.cpp",
"declarativeenginedebugclient.h",
"declarativeenginedebugclientv2.h",
"declarativetoolsclient.cpp",
"declarativetoolsclient.h",
"qdebugmessageclient.cpp",
"qdebugmessageclient.h",
"qmldebug_global.h",
"qmldebugclient.cpp",
"qmldebugclient.h",
"qmldebugcommandlinearguments.h",
"qmldebugconstants.h",
"qmlenginecontrolclient.cpp",
"qmlenginecontrolclient.h",
"qmlenginedebugclient.h",
"qmloutputparser.cpp",
"qmloutputparser.h",
"qmltoolsclient.cpp",
"qmltoolsclient.h",
"qpacketprotocol.cpp",
"qpacketprotocol.h",
]
}
}
This diff is collapsed.
......@@ -2,38 +2,42 @@ import qbs 1.0
import QtcLibrary
QtcLibrary {
Project {
name: "Timeline"
Depends { name: "Qt"; submodules: ["qml", "quick", "gui"] }
Depends { name: "Utils" }
QtcDevHeaders { }
Group {
name: "General"
files: [
"README",
"timelineabstractrenderer.cpp", "timelineabstractrenderer.h",
"timelineabstractrenderer_p.h",
"timelineitemsrenderpass.cpp", "timelineitemsrenderpass.h",
"timelinemodel.cpp", "timelinemodel.h", "timelinemodel_p.h",
"timelinemodelaggregator.cpp", "timelinemodelaggregator.h",
"timelinenotesmodel.cpp", "timelinenotesmodel.h", "timelinenotesmodel_p.h",
"timelinenotesrenderpass.cpp", "timelinenotesrenderpass.h",
"timelineoverviewrenderer.cpp", "timelineoverviewrenderer.h",
"timelineoverviewrenderer_p.h",
"timelinerenderer.cpp", "timelinerenderer.h", "timelinerenderer_p.h",
"timelinerenderpass.cpp", "timelinerenderpass.h",
"timelinerenderstate.cpp", "timelinerenderstate.h", "timelinerenderstate_p.h",
"timelineselectionrenderpass.cpp", "timelineselectionrenderpass.h",
"timelinezoomcontrol.cpp", "timelinezoomcontrol.h"
]
}
QtcLibrary {
Depends { name: "Qt"; submodules: ["qml", "quick", "gui"] }
Depends { name: "Utils" }
Group {
name: "QML"
prefix: "qml/"
files: ["timeline.qrc"]
}
Group {
name: "General"
files: [
"README",
"timelineabstractrenderer.cpp", "timelineabstractrenderer.h",
"timelineabstractrenderer_p.h",
"timelineitemsrenderpass.cpp", "timelineitemsrenderpass.h",
"timelinemodel.cpp", "timelinemodel.h", "timelinemodel_p.h",
"timelinemodelaggregator.cpp", "timelinemodelaggregator.h",
"timelinenotesmodel.cpp", "timelinenotesmodel.h", "timelinenotesmodel_p.h",
"timelinenotesrenderpass.cpp", "timelinenotesrenderpass.h",
"timelineoverviewrenderer.cpp", "timelineoverviewrenderer.h",
"timelineoverviewrenderer_p.h",
"timelinerenderer.cpp", "timelinerenderer.h", "timelinerenderer_p.h",
"timelinerenderpass.cpp", "timelinerenderpass.h",
"timelinerenderstate.cpp", "timelinerenderstate.h", "timelinerenderstate_p.h",
"timelineselectionrenderpass.cpp", "timelineselectionrenderpass.h",
"timelinezoomcontrol.cpp", "timelinezoomcontrol.h"
]
}
cpp.defines: base.concat("TIMELINE_LIBRARY")
Group {
name: "QML"
prefix: "qml/"
files: ["timeline.qrc"]
}
cpp.defines: base.concat("TIMELINE_LIBRARY")
}
}
This diff is collapsed.
import qbs 1.0
QtcPlugin {
Project {
name: "Android"
Depends { name: "Qt"; submodules: ["widgets", "xml", "network"] }
Depends { name: "Core" }
Depends { name: "Debugger" }
Depends { name: "ProjectExplorer" }
Depends { name: "QmlDebug" }
Depends { name: "QtSupport" }
Depends { name: "TextEditor" }
Depends { name: "Utils" }
QtcDevHeaders { }
files: [
"android_global.h",
"addnewavddialog.ui",
"android.qrc",
"androidanalyzesupport.cpp",
"androidanalyzesupport.h",
"androidconfigurations.cpp",
"androidconfigurations.h",
"androidconstants.h",
"androidcreatekeystorecertificate.cpp",
"androidcreatekeystorecertificate.h",
"androidcreatekeystorecertificate.ui",
"androidbuildapkstep.cpp",
"androidbuildapkstep.h",
"androidbuildapkwidget.cpp",
"androidbuildapkwidget.h",
"androidbuildapkwidget.ui",
"androiddeployqtstep.cpp",
"androiddeployqtstep.h",
"androiddebugsupport.cpp",
"androiddebugsupport.h",
"androiddevicedialog.cpp",
"androiddevicedialog.h",
"androiddevicedialog.ui",
"androiddeployconfiguration.cpp",
"androiddeployconfiguration.h",
"androiddeployqtwidget.cpp",
"androiddeployqtwidget.h",
"androiddeployqtwidget.ui",
"androiddevice.cpp",
"androiddevice.h",
"androiddevicefactory.cpp",
"androiddevicefactory.h",
"androiderrormessage.h",
"androiderrormessage.cpp",
"androidgdbserverkitinformation.cpp",
"androidgdbserverkitinformation.h",
"androidglobal.h",
"androidmanager.cpp",
"androidmanager.h",
"androidmanifestdocument.cpp",
"androidmanifestdocument.h",
"androidmanifesteditor.cpp",
"androidmanifesteditor.h",
"androidmanifesteditorfactory.cpp",
"androidmanifesteditorfactory.h",
"androidmanifesteditorwidget.cpp",
"androidmanifesteditorwidget.h",
"androidplugin.cpp",
"androidplugin.h",
"androidpotentialkit.cpp",
"androidpotentialkit.h",
"androidqtsupport.cpp",
"androidqtsupport.h",
"androidqtversion.cpp",
"androidqtversion.h",
"androidqtversionfactory.cpp",
"androidqtversionfactory.h",
"androidrunconfiguration.cpp",
"androidrunconfiguration.h",
"androidruncontrol.cpp",
"androidruncontrol.h",
"androidrunfactories.cpp",
"androidrunfactories.h",
"androidrunnable.h",
"androidrunner.cpp",
"androidrunner.h",
"androidsettingspage.cpp",
"androidsettingspage.h",
"androidsettingswidget.cpp",
"androidsettingswidget.h",
"androidsettingswidget.ui",
"androidsignaloperation.cpp",
"androidsignaloperation.h",
"androidtoolchain.cpp",
"androidtoolchain.h",
"avddialog.cpp",
"avddialog.h",
"certificatesmodel.cpp",
"certificatesmodel.h",
"javacompletionassistprovider.cpp",
"javacompletionassistprovider.h",
"javaeditor.cpp",
"javaeditor.h",
"javaindenter.cpp",
"javaindenter.h",
"javaparser.cpp",
"javaparser.h",
]
QtcPlugin {
Depends { name: "Qt"; submodules: ["widgets", "xml", "network"] }
Depends { name: "Core" }
Depends { name: "Debugger" }
Depends { name: "ProjectExplorer" }
Depends { name: "QmlDebug" }
Depends { name: "QtSupport" }
Depends { name: "TextEditor" }
Depends { name: "Utils" }
files: [
"android_global.h",
"addnewavddialog.ui",
"android.qrc",
"androidanalyzesupport.cpp",
"androidanalyzesupport.h",
"androidconfigurations.cpp",
"androidconfigurations.h",
"androidconstants.h",
"androidcreatekeystorecertificate.cpp",
"androidcreatekeystorecertificate.h",
"androidcreatekeystorecertificate.ui",
"androidbuildapkstep.cpp",
"androidbuildapkstep.h",
"androidbuildapkwidget.cpp",
"androidbuildapkwidget.h",
"androidbuildapkwidget.ui",
"androiddeployqtstep.cpp",
"androiddeployqtstep.h",
"androiddebugsupport.cpp",
"androiddebugsupport.h",
"androiddevicedialog.cpp",
"androiddevicedialog.h",
"androiddevicedialog.ui",
"androiddeployconfiguration.cpp",
"androiddeployconfiguration.h",
"androiddeployqtwidget.cpp",
"androiddeployqtwidget.h",
"androiddeployqtwidget.ui",
"androiddevice.cpp",
"androiddevice.h",
"androiddevicefactory.cpp",
"androiddevicefactory.h",
"androiderrormessage.h",
"androiderrormessage.cpp",
"androidgdbserverkitinformation.cpp",
"androidgdbserverkitinformation.h",
"androidglobal.h",
"androidmanager.cpp",
"androidmanager.h",
"androidmanifestdocument.cpp",
"androidmanifestdocument.h",
"androidmanifesteditor.cpp",
"androidmanifesteditor.h",
"androidmanifesteditorfactory.cpp",
"androidmanifesteditorfactory.h",
"androidmanifesteditorwidget.cpp",
"androidmanifesteditorwidget.h",
"androidplugin.cpp",
"androidplugin.h",
"androidpotentialkit.cpp",
"androidpotentialkit.h",
"androidqtsupport.cpp",
"androidqtsupport.h",
"androidqtversion.cpp",
"androidqtversion.h",
"androidqtversionfactory.cpp",
"androidqtversionfactory.h",
"androidrunconfiguration.cpp",
"androidrunconfiguration.h",
"androidruncontrol.cpp",
"androidruncontrol.h",
"androidrunfactories.cpp",
"androidrunfactories.h",
"androidrunnable.h",
"androidrunner.cpp",
"androidrunner.h",
"androidsettingspage.cpp",
"androidsettingspage.h",
"androidsettingswidget.cpp",
"androidsettingswidget.h",
"androidsettingswidget.ui",
"androidsignaloperation.cpp",
"androidsignaloperation.h",
"androidtoolchain.cpp",
"androidtoolchain.h",
"avddialog.cpp",
"avddialog.h",
"certificatesmodel.cpp",
"certificatesmodel.h",
"javacompletionassistprovider.cpp",
"javacompletionassistprovider.h",
"javaeditor.cpp",
"javaeditor.h",
"javaindenter.cpp",
"javaindenter.h",
"javaparser.cpp",
"javaparser.h",
]
}
}
This diff is collapsed.
This diff is collapsed.
import qbs 1.0
QtcPlugin {
Project {
name: "QmakeProjectManager"
Depends { name: "Qt"; submodules: ["widgets", "network"] }
Depends { name: "QmlJS" }
Depends { name: "Utils" }
QtcDevHeaders { }
Depends { name: "Core" }
Depends { name: "ProjectExplorer" }
Depends { name: "QtSupport" }
Depends { name: "CppTools" }
Depends { name: "TextEditor" }
Depends { name: "ResourceEditor" }
QtcPlugin {
Depends { name: "Qt"; submodules: ["widgets", "network"] }
Depends { name: "QmlJS" }
Depends { name: "Utils" }
pluginRecommends: [
"Designer"
]
Depends { name: "Core" }
Depends { name: "ProjectExplorer" }
Depends { name: "QtSupport" }
Depends { name: "CppTools" }
Depends { name: "TextEditor" }