forked from qt-creator/qt-creator
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 <joerg.bornemann@qt.io>
This commit is contained in:
6
qbs/imports/QtcCommercialPlugin.qbs
Normal file
6
qbs/imports/QtcCommercialPlugin.qbs
Normal file
@@ -0,0 +1,6 @@
|
||||
import qbs
|
||||
|
||||
QtcPlugin {
|
||||
Depends { name: "LicenseChecker"; required: false }
|
||||
cpp.defines: base.concat(LicenseChecker.present ? ["LICENSECHECKER"] : [])
|
||||
}
|
15
qbs/imports/QtcDevHeaders.qbs
Normal file
15
qbs/imports/QtcDevHeaders.qbs
Normal file
@@ -0,0 +1,15 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
|
92
qbs/modules/qtc/qtc.js
Normal file
92
qbs/modules/qtc/qtc.js
Normal file
@@ -0,0 +1,92 @@
|
||||
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();
|
||||
}
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
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" }
|
||||
|
@@ -1,8 +1,11 @@
|
||||
import qbs 1.0
|
||||
|
||||
QtcLibrary {
|
||||
Project {
|
||||
name: "Aggregation"
|
||||
|
||||
QtcDevHeaders { }
|
||||
|
||||
QtcLibrary {
|
||||
Depends { name: "Qt.core" }
|
||||
cpp.defines: base.concat("AGGREGATION_LIBRARY")
|
||||
|
||||
@@ -12,3 +15,5 @@ QtcLibrary {
|
||||
"aggregation_global.h",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,11 @@
|
||||
import qbs 1.0
|
||||
|
||||
QtcLibrary {
|
||||
Project {
|
||||
name: "ExtensionSystem"
|
||||
|
||||
QtcDevHeaders { }
|
||||
|
||||
QtcLibrary {
|
||||
cpp.defines: base.concat([
|
||||
"EXTENSIONSYSTEM_LIBRARY",
|
||||
"IDE_TEST_DIR=\".\""
|
||||
@@ -50,3 +53,4 @@ QtcLibrary {
|
||||
Depends { name: "Qt.core" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,11 @@
|
||||
import qbs 1.0
|
||||
|
||||
QtcLibrary {
|
||||
Project {
|
||||
name: "QmlDebug"
|
||||
|
||||
QtcDevHeaders { }
|
||||
|
||||
QtcLibrary {
|
||||
cpp.defines: base.concat("QMLDEBUG_LIB")
|
||||
|
||||
Depends { name: "Qt"; submodules: ["gui", "network"] }
|
||||
@@ -36,4 +39,4 @@ QtcLibrary {
|
||||
"qpacketprotocol.h",
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,9 +1,12 @@
|
||||
import qbs 1.0
|
||||
import qbs.Environment
|
||||
|
||||
QtcLibrary {
|
||||
Project {
|
||||
name: "QtcSsh"
|
||||
|
||||
QtcDevHeaders { }
|
||||
|
||||
QtcLibrary {
|
||||
cpp.defines: base.concat(["QSSH_LIBRARY"]).concat(botanDefines)
|
||||
cpp.includePaths: botanIncludes
|
||||
cpp.dynamicLibraries: botanLibs
|
||||
@@ -128,3 +131,4 @@ QtcLibrary {
|
||||
Depends { name: "Qt"; submodules: ["widgets", "network"] }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,9 +2,12 @@ import qbs 1.0
|
||||
|
||||
import QtcLibrary
|
||||
|
||||
QtcLibrary {
|
||||
Project {
|
||||
name: "Timeline"
|
||||
|
||||
QtcDevHeaders { }
|
||||
|
||||
QtcLibrary {
|
||||
Depends { name: "Qt"; submodules: ["qml", "quick", "gui"] }
|
||||
Depends { name: "Utils" }
|
||||
|
||||
@@ -37,3 +40,4 @@ QtcLibrary {
|
||||
|
||||
cpp.defines: base.concat("TIMELINE_LIBRARY")
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,13 @@
|
||||
import qbs 1.0
|
||||
import qbs.FileInfo
|
||||
|
||||
QtcLibrary {
|
||||
Project {
|
||||
name: "Utils"
|
||||
|
||||
QtcDevHeaders { }
|
||||
|
||||
QtcLibrary {
|
||||
|
||||
cpp.defines: base.concat([
|
||||
"QTCREATOR_UTILS_LIB",
|
||||
"QTC_REL_TOOLS_PATH=\"" + FileInfo.relativePath('/' + qtc.ide_bin_path,
|
||||
@@ -305,4 +309,4 @@ QtcLibrary {
|
||||
Depends { name: "Qt"; submodules: ["concurrent", "widgets" ] }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,8 +1,11 @@
|
||||
import qbs 1.0
|
||||
|
||||
QtcPlugin {
|
||||
Project {
|
||||
name: "Android"
|
||||
|
||||
QtcDevHeaders { }
|
||||
|
||||
QtcPlugin {
|
||||
Depends { name: "Qt"; submodules: ["widgets", "xml", "network"] }
|
||||
Depends { name: "Core" }
|
||||
Depends { name: "Debugger" }
|
||||
@@ -102,3 +105,4 @@ QtcPlugin {
|
||||
"javaparser.h",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@@ -1,14 +1,15 @@
|
||||
import qbs 1.0
|
||||
import qbs.FileInfo
|
||||
|
||||
QtcPlugin {
|
||||
Project {
|
||||
name: "Core"
|
||||
|
||||
QtcDevHeaders { }
|
||||
|
||||
QtcPlugin {
|
||||
Depends {
|
||||
name: "Qt"
|
||||
submodules: [
|
||||
"widgets", "xml", "network", "qml", "sql", "help", "printsupport"
|
||||
]
|
||||
submodules: ["widgets", "xml", "network", "qml", "sql", "help", "printsupport"]
|
||||
}
|
||||
|
||||
Depends {
|
||||
@@ -22,10 +23,8 @@ QtcPlugin {
|
||||
Depends { name: "app_version_header" }
|
||||
|
||||
cpp.dynamicLibraries: {
|
||||
if (qbs.targetOS.contains("windows")) return [
|
||||
"ole32",
|
||||
"user32"
|
||||
]
|
||||
if (qbs.targetOS.contains("windows"))
|
||||
return ["ole32", "user32"]
|
||||
}
|
||||
|
||||
cpp.frameworks: qbs.targetOS.contains("osx") ? ["AppKit"] : undefined
|
||||
@@ -301,3 +300,4 @@ QtcPlugin {
|
||||
Depends { name: "Utils" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,11 @@
|
||||
import qbs 1.0
|
||||
|
||||
QtcPlugin {
|
||||
Project {
|
||||
name: "Debugger"
|
||||
|
||||
QtcDevHeaders { }
|
||||
|
||||
QtcPlugin {
|
||||
Depends { name: "Qt"; submodules: ["widgets", "network"] }
|
||||
Depends { name: "Aggregation" }
|
||||
Depends { name: "CPlusPlus" }
|
||||
@@ -105,11 +108,11 @@ QtcPlugin {
|
||||
name: "cdb"
|
||||
prefix: "cdb/"
|
||||
files: [
|
||||
"stringinputstream.cpp", "stringinputstream.h",
|
||||
"cdbengine.cpp", "cdbengine.h",
|
||||
"cdboptionspage.cpp", "cdboptionspage.h",
|
||||
"cdboptionspagewidget.ui",
|
||||
"cdbparsehelpers.cpp", "cdbparsehelpers.h"
|
||||
"cdbparsehelpers.cpp", "cdbparsehelpers.h",
|
||||
"stringinputstream.cpp", "stringinputstream.h",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -282,3 +285,4 @@ QtcPlugin {
|
||||
Depends { name: "CPlusPlus" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,11 @@
|
||||
import qbs 1.0
|
||||
|
||||
QtcPlugin {
|
||||
Project {
|
||||
name: "ProjectExplorer"
|
||||
|
||||
QtcDevHeaders { }
|
||||
|
||||
QtcPlugin {
|
||||
Depends { name: "Qt"; submodules: ["widgets", "xml", "network", "qml"] }
|
||||
Depends { name: "Qt.quick" }
|
||||
Depends { name: "Aggregation" }
|
||||
@@ -261,3 +264,4 @@ QtcPlugin {
|
||||
Depends { name: "Qt.network" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,11 @@
|
||||
import qbs 1.0
|
||||
|
||||
QtcPlugin {
|
||||
Project {
|
||||
name: "QmakeProjectManager"
|
||||
|
||||
QtcDevHeaders { }
|
||||
|
||||
QtcPlugin {
|
||||
Depends { name: "Qt"; submodules: ["widgets", "network"] }
|
||||
Depends { name: "QmlJS" }
|
||||
Depends { name: "Utils" }
|
||||
@@ -109,3 +112,4 @@ QtcPlugin {
|
||||
cpp.includePaths: [project.sharedSourcesDir]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,11 @@
|
||||
import qbs 1.0
|
||||
|
||||
QtcPlugin {
|
||||
Project {
|
||||
name: "QtSupport"
|
||||
|
||||
QtcDevHeaders { }
|
||||
|
||||
QtcPlugin {
|
||||
Depends { name: "Qt"; submodules: ["quick", "widgets", "xml"]; }
|
||||
Depends { name: "QmlJS" }
|
||||
Depends { name: "Utils" }
|
||||
@@ -131,3 +134,4 @@ QtcPlugin {
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,11 @@
|
||||
import qbs 1.0
|
||||
|
||||
QtcPlugin {
|
||||
Project {
|
||||
name: "RemoteLinux"
|
||||
|
||||
QtcDevHeaders { }
|
||||
|
||||
QtcPlugin {
|
||||
Depends { name: "Qt.widgets" }
|
||||
Depends { name: "QtcSsh" }
|
||||
Depends { name: "QmlDebug" }
|
||||
@@ -118,4 +121,4 @@ QtcPlugin {
|
||||
Depends { name: "QtcSsh" }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,8 +1,11 @@
|
||||
import qbs 1.0
|
||||
|
||||
QtcPlugin {
|
||||
Project {
|
||||
name: "ResourceEditor"
|
||||
|
||||
QtcDevHeaders { }
|
||||
|
||||
QtcPlugin {
|
||||
Depends { name: "Qt"; submodules: ["widgets", "xml"] }
|
||||
Depends { name: "Aggregation" }
|
||||
Depends { name: "ProjectExplorer" }
|
||||
@@ -35,3 +38,4 @@ QtcPlugin {
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,11 @@
|
||||
import qbs 1.0
|
||||
|
||||
QtcPlugin {
|
||||
Project {
|
||||
name: "TextEditor"
|
||||
|
||||
QtcDevHeaders { }
|
||||
|
||||
QtcPlugin {
|
||||
Depends { name: "Qt"; submodules: ["widgets", "xml", "network", "printsupport"] }
|
||||
Depends { name: "Aggregation" }
|
||||
Depends { name: "Utils" }
|
||||
@@ -273,3 +276,4 @@ QtcPlugin {
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user