qbs build: Introduce new module "qtc".

The qtc module gathers properties that used to live in the top-level
project file. This is the first step towards making it possible to build
plugins against an installed Qt Creator ("out of source build").

Change-Id: Ia1514cc9c888e80be01b308e908de48980fcbdb8
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Christian Kandeler
2016-05-17 10:50:51 +02:00
parent db9437c2e8
commit a0f956f050
48 changed files with 189 additions and 152 deletions

View File

@@ -12,8 +12,8 @@ QtcProduct {
+ FileInfo.relativePath(project.ide_source_tree, sourceDirectory) + FileInfo.relativePath(project.ide_source_tree, sourceDirectory)
cpp.rpaths: [ cpp.rpaths: [
project.buildDirectory + '/' + project.ide_library_path, project.buildDirectory + '/' + qtc.ide_library_path,
project.buildDirectory + '/' + project.ide_plugin_path project.buildDirectory + '/' + qtc.ide_plugin_path
] ]
cpp.minimumOsxVersion: "10.7" cpp.minimumOsxVersion: "10.7"
cpp.defines: base.filter(function(d) { return d != "QT_RESTRICTED_CAST_FROM_ASCII"; }) cpp.defines: base.filter(function(d) { return d != "QT_RESTRICTED_CAST_FROM_ASCII"; })
@@ -28,6 +28,6 @@ QtcProduct {
// absolute paths to resources in the build directory. // absolute paths to resources in the build directory.
// cpp.rpaths: qbs.targetOS.contains("osx") // cpp.rpaths: qbs.targetOS.contains("osx")
// ? ["@loader_path/../Frameworks", "@loader_path/../PlugIns"] // ? ["@loader_path/../Frameworks", "@loader_path/../PlugIns"]
// : ["$ORIGIN/../" + project.libDirName + "/qtcreator", // : ["$ORIGIN/../" + qtc.libDirName + "/qtcreator",
// "$ORIGIN/../" project.libDirName + "/qtcreator/plugins"] // "$ORIGIN/../" qtc.libDirName + "/qtcreator/plugins"]
} }

View File

@@ -4,6 +4,7 @@ Product {
builtByDefault: false builtByDefault: false
type: [isOnlineDoc ? "qdoc-output" : "qch"] type: [isOnlineDoc ? "qdoc-output" : "qch"]
Depends { name: "Qt.core" } Depends { name: "Qt.core" }
Depends { name: "qtc" }
property path mainDocConfFile property path mainDocConfFile
property bool isOnlineDoc property bool isOnlineDoc
@@ -14,11 +15,11 @@ Product {
fileTags: ["qdocconf-main"] fileTags: ["qdocconf-main"]
} }
property string versionTag: project.qtcreator_version.replace(/\.|-/g, "") property string versionTag: qtc.qtcreator_version.replace(/\.|-/g, "")
Qt.core.qdocEnvironment: [ Qt.core.qdocEnvironment: [
"QTC_LICENSE_TYPE=" + project.licenseType, "QTC_LICENSE_TYPE=" + project.licenseType,
"QTC_VERSION=" + project.qtcreator_version, "QTC_VERSION=" + qtc.qtcreator_version,
"QTC_VERSION_TAG=" + project.qtcreator_version, "QTC_VERSION_TAG=" + qtc.qtcreator_version,
"SRCDIR=" + sourceDirectory, "SRCDIR=" + sourceDirectory,
"QT_INSTALL_DOCS=" + Qt.core.docPath, "QT_INSTALL_DOCS=" + Qt.core.docPath,
"QDOC_INDEX_DIR=" + Qt.core.docPath, "QDOC_INDEX_DIR=" + Qt.core.docPath,
@@ -28,6 +29,6 @@ Product {
Group { Group {
fileTagsFilter: ["qch"] fileTagsFilter: ["qch"]
qbs.install: !qbs.targetOS.contains("osx") qbs.install: !qbs.targetOS.contains("osx")
qbs.installDir: project.ide_doc_path qbs.installDir: qtc.ide_doc_path
} }
} }

View File

@@ -3,21 +3,21 @@ import QtcFunctions
QtcProduct { QtcProduct {
type: ["dynamiclibrary", "dynamiclibrary_symlink"] type: ["dynamiclibrary", "dynamiclibrary_symlink"]
installDir: project.ide_library_path installDir: qtc.ide_library_path
Depends { Depends {
condition: project.testsEnabled condition: qtc.testsEnabled
name: "Qt.test" name: "Qt.test"
} }
targetName: QtcFunctions.qtLibraryName(qbs, name) targetName: QtcFunctions.qtLibraryName(qbs, name)
destinationDirectory: project.ide_library_path destinationDirectory: qtc.ide_library_path
cpp.linkerFlags: { cpp.linkerFlags: {
var flags = base; var flags = base;
if (qbs.buildVariant == "debug" && qbs.toolchain.contains("msvc")) if (qbs.buildVariant == "debug" && qbs.toolchain.contains("msvc"))
flags.push("/INCREMENTAL:NO"); // Speed up startup time when debugging with cdb flags.push("/INCREMENTAL:NO"); // Speed up startup time when debugging with cdb
if (qbs.targetOS.contains("osx")) if (qbs.targetOS.contains("osx"))
flags.push("-compatibility_version", project.qtcreator_compat_version); flags.push("-compatibility_version", qtc.qtcreator_compat_version);
return flags; return flags;
} }
cpp.installNamePrefix: "@rpath" cpp.installNamePrefix: "@rpath"

View File

@@ -4,7 +4,7 @@ import QtcFunctions
QtcProduct { QtcProduct {
type: ["dynamiclibrary", "pluginSpec"] type: ["dynamiclibrary", "pluginSpec"]
installDir: project.ide_plugin_path installDir: qtc.ide_plugin_path
property var pluginJsonReplacements property var pluginJsonReplacements
property var pluginRecommends: [] property var pluginRecommends: []
@@ -14,12 +14,12 @@ QtcProduct {
condition: QtcFunctions.versionIsAtLeast(Qt.core.version, minimumQtVersion) condition: QtcFunctions.versionIsAtLeast(Qt.core.version, minimumQtVersion)
targetName: QtcFunctions.qtLibraryName(qbs, name) targetName: QtcFunctions.qtLibraryName(qbs, name)
destinationDirectory: project.ide_plugin_path destinationDirectory: qtc.ide_plugin_path
Depends { name: "ExtensionSystem" } Depends { name: "ExtensionSystem" }
Depends { name: "pluginjson" } Depends { name: "pluginjson" }
Depends { Depends {
condition: project.testsEnabled condition: qtc.testsEnabled
name: "Qt.test" name: "Qt.test"
} }
@@ -34,7 +34,7 @@ QtcProduct {
if (qbs.buildVariant == "debug" && qbs.toolchain.contains("msvc")) if (qbs.buildVariant == "debug" && qbs.toolchain.contains("msvc"))
flags.push("/INCREMENTAL:NO"); // Speed up startup time when debugging with cdb flags.push("/INCREMENTAL:NO"); // Speed up startup time when debugging with cdb
if (qbs.targetOS.contains("osx")) if (qbs.targetOS.contains("osx"))
flags.push("-compatibility_version", project.qtcreator_compat_version); flags.push("-compatibility_version", qtc.qtcreator_compat_version);
return flags; return flags;
} }

View File

@@ -2,13 +2,15 @@ import qbs 1.0
import QtcFunctions import QtcFunctions
Product { Product {
version: project.qtcreator_version version: qtc.qtcreator_version
property bool install: true property bool install: true
property string installDir property string installDir
Depends { name: "cpp" } Depends { name: "cpp" }
cpp.defines: project.generalDefines Depends { name: "qtc" }
cpp.cxxLanguageVersion: "c++11" cpp.cxxLanguageVersion: "c++11"
cpp.defines: qtc.generalDefines
cpp.linkerFlags: { cpp.linkerFlags: {
var flags = []; var flags = [];
if (qbs.buildVariant == "release" && (qbs.toolchain.contains("gcc") || qbs.toolchain.contains("mingw"))) if (qbs.buildVariant == "release" && (qbs.toolchain.contains("gcc") || qbs.toolchain.contains("mingw")))

View File

@@ -4,13 +4,13 @@ import qbs.FileInfo
QtcProduct { QtcProduct {
type: ["application"] type: ["application"]
consoleApplication: true consoleApplication: true
installDir: project.ide_libexec_path installDir: qtc.ide_libexec_path
cpp.rpaths: { cpp.rpaths: {
var relativePathToLibs = FileInfo.relativePath('/' + project.ide_libexec_path, var relativePathToLibs = FileInfo.relativePath('/' + qtc.ide_libexec_path,
'/' + project.ide_library_path); '/' + qtc.ide_library_path);
var relativePathToPlugins = FileInfo.relativePath('/' + project.ide_libexec_path, var relativePathToPlugins = FileInfo.relativePath('/' + qtc.ide_libexec_path,
'/' + project.ide_plugin_path); '/' + qtc.ide_plugin_path);
var prefix = qbs.targetOS.contains("osx") ? "@executable_path" : "$ORIGIN"; var prefix = qbs.targetOS.contains("osx") ? "@executable_path" : "$ORIGIN";
return [ return [
FileInfo.joinPaths(prefix, relativePathToLibs), FileInfo.joinPaths(prefix, relativePathToLibs),

View File

@@ -4,6 +4,7 @@ import qbs.FileInfo
Module { Module {
Depends { id: qtcore; name: "Qt.core" } Depends { id: qtcore; name: "Qt.core" }
Depends { name: "qtc" }
additionalProductTypes: ["qt_plugin_metadata"] additionalProductTypes: ["qt_plugin_metadata"]
@@ -46,20 +47,22 @@ Module {
// replace quoted quotes // replace quoted quotes
all = all.replace(/\\\"/g, '"'); all = all.replace(/\\\"/g, '"');
// replace config vars // replace config vars
vars['QTCREATOR_VERSION'] = project.qtcreator_version; var qtcVersion = product.moduleProperty("qtc", "qtcreator_version");
vars['QTCREATOR_COMPAT_VERSION'] = project.qtcreator_compat_version; vars['QTCREATOR_VERSION'] = qtcVersion;
vars['IDE_VERSION_MAJOR'] = project.ide_version_major; vars['QTCREATOR_COMPAT_VERSION']
vars['IDE_VERSION_MINOR'] = project.ide_version_minor; = product.moduleProperty("qtc", "qtcreator_compat_version");
vars['IDE_VERSION_RELEASE'] = project.ide_version_release; vars['IDE_VERSION_MAJOR'] = product.moduleProperty("qtc", "ide_version_major");
vars['IDE_VERSION_MINOR'] = product.moduleProperty("qtc", "ide_version_minor");
vars['IDE_VERSION_RELEASE'] = product.moduleProperty("qtc", "ide_version_release");
var deplist = []; var deplist = [];
for (i in plugin_depends) { for (i in plugin_depends) {
deplist.push(" { \"Name\" : \"" + plugin_depends[i] + "\", \"Version\" : \"" + project.qtcreator_version + "\" }"); deplist.push(" { \"Name\" : \"" + plugin_depends[i] + "\", \"Version\" : \"" + qtcVersion + "\" }");
} }
for (i in plugin_recommends) { for (i in plugin_recommends) {
deplist.push(" { \"Name\" : \"" + plugin_recommends[i] + "\", \"Version\" : \"" + project.qtcreator_version + "\", \"Type\" : \"optional\" }"); deplist.push(" { \"Name\" : \"" + plugin_recommends[i] + "\", \"Version\" : \"" + qtcVersion + "\", \"Type\" : \"optional\" }");
} }
for (i in plugin_test_depends) { for (i in plugin_test_depends) {
deplist.push(" { \"Name\" : \"" + plugin_test_depends[i] + "\", \"Version\" : \"" + project.qtcreator_version + "\", \"Type\" : \"test\" }"); deplist.push(" { \"Name\" : \"" + plugin_test_depends[i] + "\", \"Version\" : \"" + qtcVersion + "\", \"Type\" : \"test\" }");
} }
deplist = deplist.join(",\n") deplist = deplist.join(",\n")
vars['dependencyList'] = "\"Dependencies\" : [\n" + deplist + "\n ]"; vars['dependencyList'] = "\"Dependencies\" : [\n" + deplist + "\n ]";

View File

@@ -0,0 +1,24 @@
import qbs
import qbs.FileInfo
Module {
Depends { name: "qtc" }
property bool enableUnitTests: false
property bool enableProjectFileUpdates: true
property bool installApiHeaders: false
property string libInstallDir: qtc.ide_library_path
property stringList libRPaths: qbs.targetOS.contains("osx")
? ["@loader_path/" + FileInfo.relativePath('/' + appInstallDir, '/' + libInstallDir)]
: ["$ORIGIN/..", "$ORIGIN/../" + qtc.ide_library_path]
property string resourcesInstallDir: qtc.ide_data_path + "/qbs"
property string pluginsInstallDir: qtc.ide_plugin_path
property string appInstallDir: qtc.ide_bin_path
property string libexecInstallDir: qtc.ide_libexec_path
property string relativeLibexecPath: FileInfo.relativePath('/' + appInstallDir,
'/' + libexecInstallDir)
property string relativePluginsPath: FileInfo.relativePath('/' + appInstallDir,
'/' + pluginsInstallDir)
property string relativeSearchPath: FileInfo.relativePath('/' + appInstallDir,
'/' + resourcesInstallDir)
}

57
qbs/modules/qtc/qtc.qbs Normal file
View File

@@ -0,0 +1,57 @@
import qbs
import qbs.Environment
Module {
property string ide_version_major: '4'
property string ide_version_minor: '0'
property string ide_version_release: '82'
property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.'
+ ide_version_release
property string ide_compat_version_major: '4'
property string ide_compat_version_minor: '0'
property string ide_compat_version_release: '82'
property string qtcreator_compat_version: ide_compat_version_major + '.'
+ ide_compat_version_minor + '.' + ide_compat_version_release
property string libDirName: "lib"
property string ide_app_path: qbs.targetOS.contains("osx") ? "" : "bin"
property string ide_app_target: qbs.targetOS.contains("osx") ? "Qt Creator" : "qtcreator"
property string ide_library_path: {
if (qbs.targetOS.contains("osx"))
return ide_app_target + ".app/Contents/Frameworks"
else if (qbs.targetOS.contains("windows"))
return ide_app_path
else
return libDirName + "/qtcreator"
}
property string ide_plugin_path: {
if (qbs.targetOS.contains("osx"))
return ide_app_target + ".app/Contents/PlugIns"
else if (qbs.targetOS.contains("windows"))
return libDirName + "/qtcreator/plugins"
else
return ide_library_path + "/plugins"
}
property string ide_data_path: qbs.targetOS.contains("osx")
? ide_app_target + ".app/Contents/Resources"
: "share/qtcreator"
property string ide_libexec_path: qbs.targetOS.contains("osx")
? ide_data_path : qbs.targetOS.contains("windows")
? ide_app_path
: "libexec/qtcreator"
property string ide_bin_path: qbs.targetOS.contains("osx")
? ide_app_target + ".app/Contents/MacOS"
: ide_app_path
property string ide_doc_path: qbs.targetOS.contains("osx")
? ide_data_path + "/doc"
: "share/doc/qtcreator"
property bool testsEnabled: Environment.getEnv("TEST") || qbs.buildVariant === "debug"
property stringList generalDefines: [
"QT_CREATOR",
'IDE_LIBRARY_BASENAME="' + libDirName + '"',
"QT_NO_CAST_TO_ASCII",
"QT_RESTRICTED_CAST_FROM_ASCII"
].concat(testsEnabled ? ["WITH_TESTS"] : [])
}

View File

@@ -7,59 +7,12 @@ Project {
minimumQbsVersion: "1.5.0" minimumQbsVersion: "1.5.0"
property bool withAutotests: qbs.buildVariant === "debug" property bool withAutotests: qbs.buildVariant === "debug"
property string licenseType: "opensource" property string licenseType: "opensource"
property string ide_version_major: '4'
property string ide_version_minor: '0'
property string ide_version_release: '82'
property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release
property string ide_compat_version_major: '4'
property string ide_compat_version_minor: '0'
property string ide_compat_version_release: '82'
property string qtcreator_compat_version: ide_compat_version_major + '.' + ide_compat_version_minor + '.' + ide_compat_version_release
property path ide_source_tree: path property path ide_source_tree: path
property string ide_app_path: qbs.targetOS.contains("osx") ? "" : "bin"
property string ide_app_target: qbs.targetOS.contains("osx") ? "Qt Creator" : "qtcreator"
property pathList additionalPlugins: [] property pathList additionalPlugins: []
property pathList additionalLibs: [] property pathList additionalLibs: []
property pathList additionalTools: [] property pathList additionalTools: []
property pathList additionalAutotests: [] property pathList additionalAutotests: []
property string sharedSourcesDir: path + "/src/shared" property string sharedSourcesDir: path + "/src/shared"
property string libDirName: "lib"
property string ide_library_path: {
if (qbs.targetOS.contains("osx"))
return ide_app_target + ".app/Contents/Frameworks"
else if (qbs.targetOS.contains("windows"))
return ide_app_path
else
return libDirName + "/qtcreator"
}
property string ide_plugin_path: {
if (qbs.targetOS.contains("osx"))
return ide_app_target + ".app/Contents/PlugIns"
else if (qbs.targetOS.contains("windows"))
return libDirName + "/qtcreator/plugins"
else
return ide_library_path + "/plugins"
}
property string ide_data_path: qbs.targetOS.contains("osx")
? ide_app_target + ".app/Contents/Resources"
: "share/qtcreator"
property string ide_libexec_path: qbs.targetOS.contains("osx")
? ide_data_path : qbs.targetOS.contains("windows")
? ide_app_path
: "libexec/qtcreator"
property string ide_doc_path: qbs.targetOS.contains("osx")
? ide_data_path + "/doc"
: "share/doc/qtcreator"
property string ide_bin_path: qbs.targetOS.contains("osx")
? ide_app_target + ".app/Contents/MacOS"
: ide_app_path
property bool testsEnabled: Environment.getEnv("TEST") || qbs.buildVariant === "debug"
property stringList generalDefines: [
"QT_CREATOR",
'IDE_LIBRARY_BASENAME="' + libDirName + '"',
"QT_NO_CAST_TO_ASCII",
"QT_RESTRICTED_CAST_FROM_ASCII"
].concat(testsEnabled ? ["WITH_TESTS"] : [])
qbsSearchPaths: "qbs" qbsSearchPaths: "qbs"
references: [ references: [
@@ -72,6 +25,7 @@ Project {
AutotestRunner { AutotestRunner {
Depends { name: "Qt.core" } Depends { name: "Qt.core" }
Depends { name: "qtc" }
environment: { environment: {
var env = base; var env = base;
if (!qbs.hostOS.contains("windows") || !qbs.targetOS.contains("windows")) if (!qbs.hostOS.contains("windows") || !qbs.targetOS.contains("windows"))
@@ -85,9 +39,10 @@ Project {
} }
var fullQtcInstallDir var fullQtcInstallDir
= FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix, qbs.InstallDir); = FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix, qbs.InstallDir);
var fullLibInstallDir = FileInfo.joinPaths(fullQtcInstallDir, project.ide_library_path); var fullLibInstallDir = FileInfo.joinPaths(fullQtcInstallDir,
var fullPluginInstallDir product.moduleProperty("ide", "ide_library_path"));
= FileInfo.joinPaths(fullQtcInstallDir, project.ide_plugin_path); var fullPluginInstallDir = FileInfo.joinPaths(fullQtcInstallDir,
product.moduleProperty("qtc", "ide_plugin_path"));
path = Qt.core.binPath + ";" + fullLibInstallDir + ";" + fullPluginInstallDir path = Qt.core.binPath + ";" + fullLibInstallDir + ";" + fullPluginInstallDir
+ ";" + path; + ";" + path;
var arrayElem = "PATH=" + path; var arrayElem = "PATH=" + path;

View File

@@ -4,6 +4,7 @@ Product {
name: "Translations" name: "Translations"
type: "qm" type: "qm"
Depends { name: "Qt.core" } Depends { name: "Qt.core" }
Depends { name: "qtc" }
Group { Group {
files: ["*.ts"] files: ["*.ts"]
@@ -17,6 +18,6 @@ Product {
Group { Group {
fileTagsFilter: product.type fileTagsFilter: product.type
qbs.install: true qbs.install: true
qbs.installDir: project.ide_data_path + "/translations" qbs.installDir: qtc.ide_data_path + "/translations"
} }
} }

View File

@@ -2,11 +2,12 @@ import qbs 1.0
Product { Product {
name: "SharedContent" name: "SharedContent"
Depends { name: "qtc" }
Group { Group {
name: "Unconditional" name: "Unconditional"
qbs.install: true qbs.install: true
qbs.installDir: project.ide_data_path qbs.installDir: qtc.ide_data_path
qbs.installSourceBase: "qtcreator" qbs.installSourceBase: "qtcreator"
prefix: "qtcreator/" prefix: "qtcreator/"
files: [ files: [
@@ -31,7 +32,7 @@ Product {
Group { Group {
name: "3rdparty" name: "3rdparty"
qbs.install: true qbs.install: true
qbs.installDir: project.ide_data_path qbs.installDir: qtc.ide_data_path
qbs.installSourceBase: project.ide_source_tree + "/src/share/3rdparty" qbs.installSourceBase: project.ide_source_tree + "/src/share/3rdparty"
prefix: project.ide_source_tree + "/src/share/3rdparty/" prefix: project.ide_source_tree + "/src/share/3rdparty/"
files: [ files: [
@@ -42,7 +43,7 @@ Product {
Group { Group {
name: "Conditional" name: "Conditional"
qbs.install: true qbs.install: true
qbs.installDir: project.ide_data_path + "/externaltools" qbs.installDir: qtc.ide_data_path + "/externaltools"
prefix: project.ide_source_tree + "/src/share/qtcreator/externaltools/" prefix: project.ide_source_tree + "/src/share/qtcreator/externaltools/"
files: { files: {
var list = [ var list = [

View File

@@ -18,14 +18,15 @@ QtcProduct {
consoleApplication: false consoleApplication: false
type: ["application"] type: ["application"]
name: project.ide_app_target name: "qtcreator"
version: project.qtcreator_version targetName: qtc.ide_app_target
version: qtc.qtcreator_version
installDir: project.ide_bin_path installDir: qtc.ide_bin_path
property bool qtcRunnable: true property bool qtcRunnable: true
cpp.rpaths: qbs.targetOS.contains("osx") ? ["@executable_path/../Frameworks"] cpp.rpaths: qbs.targetOS.contains("osx") ? ["@executable_path/../Frameworks"]
: ["$ORIGIN/../" + project.libDirName + "/qtcreator"] : ["$ORIGIN/../" + qtc.libDirName + "/qtcreator"]
cpp.includePaths: [ cpp.includePaths: [
project.sharedSourcesDir + "/qtsingleapplication", project.sharedSourcesDir + "/qtsingleapplication",
project.sharedSourcesDir + "/qtlockedfile", project.sharedSourcesDir + "/qtlockedfile",

View File

@@ -6,6 +6,8 @@ Product {
type: "hpp" type: "hpp"
files: "app_version.h.in" files: "app_version.h.in"
Depends { name: "qtc" }
Transformer { Transformer {
inputs: ["app_version.h.in"] inputs: ["app_version.h.in"]
Artifact { Artifact {
@@ -26,10 +28,14 @@ Product {
if (onWindows) if (onWindows)
content = content.replace(/\r\n/g, "\n"); content = content.replace(/\r\n/g, "\n");
// replace the magic qmake incantations // replace the magic qmake incantations
content = content.replace(/(\n#define IDE_VERSION) .+\n/, "$1 " + project.qtcreator_version + "\n"); content = content.replace(/(\n#define IDE_VERSION) .+\n/, "$1 "
content = content.replace(/(\n#define IDE_VERSION_MAJOR) .+\n/, "$1 " + project.ide_version_major + "\n") + product.moduleProperty("qtc", "qtcreator_version") + "\n");
content = content.replace(/(\n#define IDE_VERSION_MINOR) .+\n/, "$1 " + project.ide_version_minor + "\n") content = content.replace(/(\n#define IDE_VERSION_MAJOR) .+\n/, "$1 "
content = content.replace(/(\n#define IDE_VERSION_RELEASE) .+\n/, "$1 " + project.ide_version_release + "\n") + product.moduleProperty("qtc", "ide_version_major") + "\n");
content = content.replace(/(\n#define IDE_VERSION_MINOR) .+\n/, "$1 "
+ product.moduleProperty("qtc", "ide_version_minor") + "\n");
content = content.replace(/(\n#define IDE_VERSION_RELEASE) .+\n/, "$1 "
+ product.moduleProperty("qtc", "ide_version_release") + "\n");
file = new TextFile(output.filePath, TextFile.WriteOnly); file = new TextFile(output.filePath, TextFile.WriteOnly);
file.truncate(); file.truncate();
file.write(content); file.write(content);

View File

@@ -57,7 +57,7 @@ QtcLibrary {
dirName += "64"; dirName += "64";
else else
dirName += "32"; dirName += "32";
return FileInfo.joinPaths(project.libDirName, dirName); return FileInfo.joinPaths(qtc.libDirName, dirName);
} }
files: [ files: [
"common.cpp", "common.cpp",

View File

@@ -6,8 +6,8 @@ QtcLibrary {
cpp.defines: base.concat([ cpp.defines: base.concat([
"QTCREATOR_UTILS_LIB", "QTCREATOR_UTILS_LIB",
"QTC_REL_TOOLS_PATH=\"" + FileInfo.relativePath('/' + project.ide_bin_path, "QTC_REL_TOOLS_PATH=\"" + FileInfo.relativePath('/' + qtc.ide_bin_path,
'/' + project.ide_libexec_path) + "\"" '/' + qtc.ide_libexec_path) + "\""
]) ])
cpp.dynamicLibraries: { cpp.dynamicLibraries: {
var libs = []; var libs = [];

View File

@@ -18,12 +18,12 @@ QtcPlugin {
Depends { Depends {
name: "QtSupport" name: "QtSupport"
condition: project.testsEnabled condition: qtc.testsEnabled
} }
Depends { Depends {
name: "Qt.test" name: "Qt.test"
condition: project.testsEnabled condition: qtc.testsEnabled
} }
Depends { name: "Qt.widgets" } Depends { name: "Qt.widgets" }
@@ -92,7 +92,7 @@ QtcPlugin {
Group { Group {
name: "Test sources" name: "Test sources"
condition: project.testsEnabled condition: qtc.testsEnabled
files: [ files: [
"autotestunittests.cpp", "autotestunittests.cpp",
"autotestunittests.h", "autotestunittests.h",
@@ -108,6 +108,6 @@ QtcPlugin {
] ]
fileTags: [] fileTags: []
qbs.install: true qbs.install: true
qbs.installDir: project.ide_data_path + "/templates/wizards/autotest" qbs.installDir: qtc.ide_data_path + "/templates/wizards/autotest"
} }
} }

View File

@@ -97,7 +97,7 @@ QtcPlugin {
Group { Group {
name: "Tests" name: "Tests"
condition: project.testsEnabled condition: qtc.testsEnabled
prefix: "test/" prefix: "test/"
files: [ files: [
"data/clangtestdata.qrc", "data/clangtestdata.qrc",

View File

@@ -57,7 +57,7 @@ QtcPlugin {
Group { Group {
name: "Unit tests" name: "Unit tests"
condition: project.testsEnabled condition: qtc.testsEnabled
files: [ files: [
"clangstaticanalyzerunittests.cpp", "clangstaticanalyzerunittests.cpp",
"clangstaticanalyzerunittests.h", "clangstaticanalyzerunittests.h",

View File

@@ -193,7 +193,7 @@ QtcPlugin {
Group { Group {
name: "Tests" name: "Tests"
condition: project.testsEnabled condition: qtc.testsEnabled
files: [ files: [
"testdatadir.cpp", "testdatadir.cpp",
"testdatadir.h", "testdatadir.h",

View File

@@ -57,7 +57,7 @@ QtcPlugin {
Group { Group {
name: "Tests" name: "Tests"
condition: project.testsEnabled condition: qtc.testsEnabled
files: [ files: [
"cppdoxygen_test.cpp", "cppdoxygen_test.h", "cppdoxygen_test.cpp", "cppdoxygen_test.h",
"cppeditortestcase.cpp", "cppeditortestcase.h", "cppeditortestcase.cpp", "cppeditortestcase.h",

View File

@@ -105,7 +105,7 @@ QtcPlugin {
Group { Group {
name: "Tests" name: "Tests"
condition: project.testsEnabled condition: qtc.testsEnabled
files: [ files: [
"cppcodegen_test.cpp", "cppcodegen_test.cpp",
"cppcompletion_test.cpp", "cppcompletion_test.cpp",

View File

@@ -21,7 +21,7 @@ QtcPlugin {
Depends { Depends {
name: "Qt.test" name: "Qt.test"
condition: project.testsEnabled condition: qtc.testsEnabled
} }
pluginTestDepends: [ pluginTestDepends: [
@@ -265,7 +265,7 @@ QtcPlugin {
Group { Group {
name: "Unit tests" name: "Unit tests"
condition: project.testsEnabled condition: qtc.testsEnabled
files: [ files: [
"debuggerunittests.qrc", "debuggerunittests.qrc",
] ]

View File

@@ -74,7 +74,7 @@ QtcPlugin {
Group { Group {
name: "Tests" name: "Tests"
condition: project.testsEnabled condition: qtc.testsEnabled
files: [ "gotoslot_test.cpp" ] files: [ "gotoslot_test.cpp" ]
cpp.defines: outer.concat(['SRCDIR="' + FileInfo.path(filePath) + '"']) cpp.defines: outer.concat(['SRCDIR="' + FileInfo.path(filePath) + '"'])

View File

@@ -29,7 +29,7 @@ QtcPlugin {
Group { Group {
name: "Tests" name: "Tests"
condition: project.testsEnabled condition: qtc.testsEnabled
files: ["fakevim_test.cpp"] files: ["fakevim_test.cpp"]
} }
} }

View File

@@ -43,7 +43,7 @@ QtcPlugin {
Group { Group {
name: "Tests" name: "Tests"
condition: project.testsEnabled condition: qtc.testsEnabled
files: [ "genericprojectplugin_test.cpp" ] files: [ "genericprojectplugin_test.cpp" ]
cpp.defines: outer.concat(['SRCDIR="' + FileInfo.path(filePath) + '"']) cpp.defines: outer.concat(['SRCDIR="' + FileInfo.path(filePath) + '"'])

View File

@@ -236,7 +236,7 @@ QtcPlugin {
Group { Group {
name: "WindowsToolChains" name: "WindowsToolChains"
condition: qbs.targetOS.contains("windows") || project.testsEnabled condition: qbs.targetOS.contains("windows") || qtc.testsEnabled
files: [ files: [
"abstractmsvctoolchain.cpp", "abstractmsvctoolchain.cpp",
"abstractmsvctoolchain.h", "abstractmsvctoolchain.h",
@@ -253,7 +253,7 @@ QtcPlugin {
Group { Group {
name: "Tests" name: "Tests"
condition: project.testsEnabled condition: qtc.testsEnabled
files: ["outputparser_test.h", "outputparser_test.cpp"] files: ["outputparser_test.h", "outputparser_test.cpp"]
} }

View File

@@ -7,7 +7,7 @@ QtcPlugin {
property var externalQbsIncludes: project.useExternalQbs property var externalQbsIncludes: project.useExternalQbs
? [project.qbs_install_dir + "/include/qbs"] : [] ? [project.qbs_install_dir + "/include/qbs"] : []
property var externalQbsLibraryPaths: project.useExternalQbs property var externalQbsLibraryPaths: project.useExternalQbs
? [project.qbs_install_dir + '/' + project.libDirName] : [] ? [project.qbs_install_dir + '/' + qtc.libDirName] : []
property var externalQbsDynamicLibraries: { property var externalQbsDynamicLibraries: {
var libs = [] var libs = []
if (!project.useExternalQbs) if (!project.useExternalQbs)

View File

@@ -3,7 +3,7 @@ import qbs
QtcProduct { QtcProduct {
name: "componentsplugin" name: "componentsplugin"
type: ["dynamiclibrary"] type: ["dynamiclibrary"]
installDir: project.ide_plugin_path + '/' + installDirName installDir: qtc.ide_plugin_path + '/' + installDirName
property string installDirName: qbs.targetOS.contains("osx") ? "QmlDesigner" : "qmldesigner" property string installDirName: qbs.targetOS.contains("osx") ? "QmlDesigner" : "qmldesigner"
Depends { name: "Core" } Depends { name: "Core" }

View File

@@ -3,7 +3,7 @@ import qbs
QtcProduct { QtcProduct {
name: "qtquickplugin" name: "qtquickplugin"
type: ["dynamiclibrary"] type: ["dynamiclibrary"]
installDir: project.ide_plugin_path + '/' + installDirName installDir: qtc.ide_plugin_path + '/' + installDirName
property string installDirName: qbs.targetOS.contains("osx") ? "QmlDesigner" : "qmldesigner" property string installDirName: qbs.targetOS.contains("osx") ? "QmlDesigner" : "qmldesigner"
cpp.defines: base.concat("QTQUICK_LIBRARY") cpp.defines: base.concat("QTQUICK_LIBRARY")

View File

@@ -49,7 +49,7 @@ QtcPlugin {
Group { Group {
name: "Tests" name: "Tests"
condition: project.testsEnabled condition: qtc.testsEnabled
files: ["qmljstools_test.cpp"] files: ["qmljstools_test.cpp"]
} }

View File

@@ -74,7 +74,7 @@ QtcPlugin {
Group { Group {
name: "Unit tests" name: "Unit tests"
condition: project.testsEnabled condition: qtc.testsEnabled
prefix: "tests/" prefix: "tests/"
files: [ files: [
"debugmessagesmodel_test.cpp", "debugmessagesmodel_test.h", "debugmessagesmodel_test.cpp", "debugmessagesmodel_test.h",

View File

@@ -267,7 +267,7 @@ QtcPlugin {
Group { Group {
name: "Tests" name: "Tests"
condition: project.testsEnabled condition: qtc.testsEnabled
files: [ files: [
"texteditor_test.cpp", "texteditor_test.cpp",
] ]

View File

@@ -82,5 +82,5 @@ QtcPlugin {
"wizard/vcsjsextension.h", "wizard/vcsjsextension.h",
] ]
cpp.defines: base.concat( testsEnabled ? ['SRC_DIR="' + project.ide_source_tree + '"'] : [] ) cpp.defines: base.concat(qtc.testsEnabled ? ['SRC_DIR="' + qtc.ide_source_tree + '"'] : [])
} }

View File

@@ -23,25 +23,9 @@ Project {
id: qbsProject id: qbsProject
property string qbsBaseDir: project.sharedSourcesDir + "/qbs" property string qbsBaseDir: project.sharedSourcesDir + "/qbs"
condition: qbsSubModuleExists && !useExternalQbs condition: qbsSubModuleExists && !useExternalQbs
qbsSearchPaths: [qbsBaseDir + "/qbs-resources"]
property bool enableUnitTests: false // The first entry is for overriding qbs' own qbsbuildconfig module.
property bool enableProjectFileUpdates: true qbsSearchPaths: [project.ide_source_tree + "/qbs", qbsBaseDir + "/qbs-resources"]
property bool installApiHeaders: false
property string libInstallDir: project.ide_library_path
property stringList libRPaths: qbs.targetOS.contains("osx")
? ["@loader_path/" + FileInfo.relativePath('/' + appInstallDir, '/' + libInstallDir)]
: ["$ORIGIN/..", "$ORIGIN/../" + project.ide_library_path]
property string resourcesInstallDir: project.ide_data_path + "/qbs"
property string pluginsInstallDir: project.ide_plugin_path
property string appInstallDir: project.ide_bin_path
property string libexecInstallDir: project.ide_libexec_path
property string relativeLibexecPath: FileInfo.relativePath('/' + appInstallDir,
'/' + libexecInstallDir)
property string relativePluginsPath: FileInfo.relativePath('/' + appInstallDir,
'/' + pluginsInstallDir)
property string relativeSearchPath: FileInfo.relativePath('/' + appInstallDir,
'/' + resourcesInstallDir)
references: [ references: [
qbsBaseDir + "/src/lib/libs.qbs", qbsBaseDir + "/src/lib/libs.qbs",

View File

@@ -26,5 +26,5 @@ QtcTool {
cpp.frameworkPaths: base.concat("/System/Library/PrivateFrameworks") cpp.frameworkPaths: base.concat("/System/Library/PrivateFrameworks")
bundle.infoPlistFile: "Info.plist" bundle.infoPlistFile: "Info.plist"
installDir: project.ide_libexec_path + "/ios" installDir: qtc.ide_libexec_path + "/ios"
} }

View File

@@ -13,8 +13,8 @@ QtcTool {
] ]
Properties { Properties {
condition: qbs.targetOS.contains("unix") && !qbs.targetOS.contains("darwin") condition: qbs.targetOS.contains("unix") && !qbs.targetOS.contains("darwin")
cpp.rpaths: base.concat(["$ORIGIN/../" + project.ide_plugin_path]) cpp.rpaths: base.concat(["$ORIGIN/../" + qtc.ide_plugin_path])
} }
cpp.defines: base.concat(qbs.targetOS.contains("windows") || project.testsEnabled cpp.defines: base.concat(qbs.targetOS.contains("windows") || qtc.testsEnabled
? ["HAS_MSVC_PARSER"] : []) ? ["HAS_MSVC_PARSER"] : [])
} }

View File

@@ -20,5 +20,5 @@ QtcTool {
cpp.dynamicLibraries: base.concat(["ssl", "bz2"]) cpp.dynamicLibraries: base.concat(["ssl", "bz2"])
bundle.infoPlistFile: "Info.plist" bundle.infoPlistFile: "Info.plist"
installDir: project.ide_libexec_path + "/ios" installDir: qtc.ide_libexec_path + "/ios"
} }

View File

@@ -4,7 +4,7 @@ import QtcFunctions
QtcTool { QtcTool {
name: "qml2puppet" name: "qml2puppet"
installDir: qbs.targetOS.contains("osx") installDir: qbs.targetOS.contains("osx")
? project.ide_libexec_path + "/qmldesigner" : project.ide_libexec_path ? qtc.ide_libexec_path + "/qmldesigner" : qtc.ide_libexec_path
Depends { name: "bundle" } Depends { name: "bundle" }
Depends { Depends {

View File

@@ -3,7 +3,7 @@ import qbs 1.0
QtcTool { QtcTool {
name: "qtcreator_crash_handler" name: "qtcreator_crash_handler"
condition: qbs.targetOS.contains("linux") && qbs.buildVariant == "debug" condition: qbs.targetOS.contains("linux") && qbs.buildVariant == "debug"
installDir: project.ide_bin_path installDir: qtc.ide_bin_path
Depends { name: "Utils" } Depends { name: "Utils" }
Depends { name: "Qt.widgets" } Depends { name: "Qt.widgets" }

View File

@@ -3,8 +3,9 @@ import qbs
CppApplication { CppApplication {
name: "valgrind-fake" name: "valgrind-fake"
consoleApplication: true consoleApplication: true
destinationDirectory: project.ide_bin_path destinationDirectory: qtc.ide_bin_path
Depends { name: "Qt"; submodules: ["network", "xml"]; } Depends { name: "Qt"; submodules: ["network", "xml"]; }
Depends { name: "qtc" }
cpp.cxxLanguageVersion: "c++11" cpp.cxxLanguageVersion: "c++11"
files: [ files: [
"main.cpp", "main.cpp",

View File

@@ -8,12 +8,13 @@ DynamicLibrary {
Depends { name: "cpp" } Depends { name: "cpp" }
Depends { name: "Qt.core" } Depends { name: "Qt.core" }
Depends { name: "copyable_resource" } Depends { name: "copyable_resource" }
Depends { name: "qtc" }
targetName: QtcFunctions.qtLibraryName(qbs, name.split('_')[1]) targetName: QtcFunctions.qtLibraryName(qbs, name.split('_')[1])
destinationDirectory: project.buildDirectory + '/' destinationDirectory: project.buildDirectory + '/'
+ FileInfo.relativePath(project.ide_source_tree, sourceDirectory) + FileInfo.relativePath(project.ide_source_tree, sourceDirectory)
cpp.rpaths: [ cpp.rpaths: [
project.buildDirectory + "/" + project.libDirName + "/qtcreator", project.buildDirectory + "/" + qtc.libDirName + "/qtcreator",
project.buildDirectory + "/" + project.libDirName + "/qtcreator/plugins" project.buildDirectory + "/" + qtc.libDirName + "/qtcreator/plugins"
].concat(additionalRPaths) ].concat(additionalRPaths)
cpp.cxxLanguageVersion: "c++11" cpp.cxxLanguageVersion: "c++11"
property pathList additionalRPaths: [] property pathList additionalRPaths: []

View File

@@ -8,5 +8,5 @@ QtcAutotest {
files: "tst_sdktool.cpp" files: "tst_sdktool.cpp"
} }
cpp.defines: base.concat(['SDKTOOL_DIR="' + qbs.installRoot + '/' + project.ide_libexec_path + '"']) cpp.defines: base.concat(['SDKTOOL_DIR="' + qbs.installRoot + '/' + qtc.ide_libexec_path + '"'])
} }

View File

@@ -8,6 +8,6 @@ ValgrindAutotest {
files: ["modeldemo.h", "modeldemo.cpp"] files: ["modeldemo.h", "modeldemo.cpp"]
cpp.defines: base.concat([ cpp.defines: base.concat([
'PARSERTESTS_DATA_DIR="' + path + '/data"', 'PARSERTESTS_DATA_DIR="' + path + '/data"',
'VALGRIND_FAKE_PATH="' + project.buildDirectory + '/' + project.ide_bin_path + '/valgrind-fake"' 'VALGRIND_FAKE_PATH="' + project.buildDirectory + '/' + qtc.ide_bin_path + '/valgrind-fake"'
]) ])
} }

View File

@@ -8,6 +8,6 @@ ValgrindAutotest {
files: ["parsertests.h", "parsertests.cpp"] files: ["parsertests.h", "parsertests.cpp"]
cpp.defines: base.concat([ cpp.defines: base.concat([
'PARSERTESTS_DATA_DIR="' + path + '/data"', 'PARSERTESTS_DATA_DIR="' + path + '/data"',
'VALGRIND_FAKE_PATH="' + project.buildDirectory + '/' + project.ide_bin_path + '/valgrind-fake"' 'VALGRIND_FAKE_PATH="' + project.buildDirectory + '/' + qtc.ide_bin_path + '/valgrind-fake"'
]) ])
} }

View File

@@ -7,6 +7,6 @@ QtcAutotest {
property string testName property string testName
targetName: testName // Test runner hardcodes the names of the executables targetName: testName // Test runner hardcodes the names of the executables
destinationDirectory: project.buildDirectory + '/' destinationDirectory: project.buildDirectory + '/'
+ project.ide_bin_path + '/testapps/' + testName + qtc.ide_bin_path + '/testapps/' + testName
files: "main.cpp" files: "main.cpp"
} }

View File

@@ -16,7 +16,7 @@ ValgrindAutotest {
Depends { name: "Memcheck uninit2 autotest" } Depends { name: "Memcheck uninit2 autotest" }
Depends { name: "Memcheck uninit3 autotest" } Depends { name: "Memcheck uninit3 autotest" }
files: ["testrunner.h", "testrunner.cpp"] files: ["testrunner.h", "testrunner.cpp"]
destinationDirectory: project.ide_bin_path destinationDirectory: qtc.ide_bin_path
cpp.defines: base.concat([ cpp.defines: base.concat([
'TESTRUNNER_SRC_DIR="' + path + '/testapps"', 'TESTRUNNER_SRC_DIR="' + path + '/testapps"',
'TESTRUNNER_APP_DIR="' + project.buildDirectory + '/' + destinationDirectory + '/testapps"' 'TESTRUNNER_APP_DIR="' + project.buildDirectory + '/' + destinationDirectory + '/testapps"'