forked from qt-creator/qt-creator
Support built-in testing infrastructure with qbs build.
I.e. define WITH_TESTS for debug builds or if the respective environment variable is set. Change-Id: I2764ece50d0783e8cb030b1695e6f59cf6063248 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
This commit is contained in:
committed by
Joerg Bornemann
parent
405217c111
commit
40d919eed8
12
qbs/defaults.js
Normal file
12
qbs/defaults.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
function testsEnabled(qbs)
|
||||||
|
{
|
||||||
|
return qbs.getenv("TEST") || qbs.buildVariant === "debug";
|
||||||
|
}
|
||||||
|
|
||||||
|
function defines(qbs)
|
||||||
|
{
|
||||||
|
var list = [ 'IDE_LIBRARY_BASENAME="lib"' ]
|
||||||
|
if (testsEnabled(qbs))
|
||||||
|
list.push("WITH_TESTS")
|
||||||
|
return list
|
||||||
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
import qbs.base 1.0
|
import qbs.base 1.0
|
||||||
import qbs.fileinfo 1.0 as FileInfo
|
import qbs.fileinfo 1.0 as FileInfo
|
||||||
|
import "qbs/defaults.js" as Defaults
|
||||||
|
|
||||||
Project {
|
Project {
|
||||||
property string ide_version_major: '2'
|
property string ide_version_major: '2'
|
||||||
property string ide_version_minor: '6'
|
property string ide_version_minor: '6'
|
||||||
property string ide_version_release: '81'
|
property string ide_version_release: '81'
|
||||||
property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release
|
property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release
|
||||||
property var additionalCppDefines: [ 'IDE_LIBRARY_BASENAME="lib"' ]
|
|
||||||
moduleSearchPaths: "qbs"
|
moduleSearchPaths: "qbs"
|
||||||
|
|
||||||
references: [
|
references: [
|
||||||
@@ -135,7 +135,7 @@ Project {
|
|||||||
consoleApplication: qbs.debugInformation
|
consoleApplication: qbs.debugInformation
|
||||||
|
|
||||||
cpp.rpaths: ["$ORIGIN/../lib/qtcreator"]
|
cpp.rpaths: ["$ORIGIN/../lib/qtcreator"]
|
||||||
cpp.defines: project.additionalCppDefines
|
cpp.defines: Defaults.defines(qbs)
|
||||||
cpp.linkerFlags: {
|
cpp.linkerFlags: {
|
||||||
if (qbs.buildVariant == "release" && (qbs.toolchain == "gcc" || qbs.toolchain == "mingw"))
|
if (qbs.buildVariant == "release" && (qbs.toolchain == "gcc" || qbs.toolchain == "mingw"))
|
||||||
return ["-Wl,-s"]
|
return ["-Wl,-s"]
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
import qbs.base 1.0
|
import qbs.base 1.0
|
||||||
|
import "../../qbs/defaults.js" as Defaults
|
||||||
|
|
||||||
DynamicLibrary {
|
DynamicLibrary {
|
||||||
Depends { name: "cpp" }
|
Depends { name: "cpp" }
|
||||||
|
Depends {
|
||||||
|
condition: Defaults.testsEnabled(qbs)
|
||||||
|
name: "Qt.test"
|
||||||
|
}
|
||||||
|
|
||||||
|
cpp.defines: Defaults.defines(qbs)
|
||||||
cpp.linkerFlags: {
|
cpp.linkerFlags: {
|
||||||
if (qbs.buildVariant == "release" && (qbs.toolchain == "gcc" || qbs.toolchain == "mingw"))
|
if (qbs.buildVariant == "release" && (qbs.toolchain == "gcc" || qbs.toolchain == "mingw"))
|
||||||
return ["-Wl,-s"]
|
return ["-Wl,-s"]
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ QtcLibrary {
|
|||||||
".",
|
".",
|
||||||
".."
|
".."
|
||||||
]
|
]
|
||||||
cpp.defines: [
|
cpp.defines: base.concat([
|
||||||
"EXTENSIONSYSTEM_LIBRARY",
|
"EXTENSIONSYSTEM_LIBRARY",
|
||||||
"IDE_TEST_DIR=\".\""
|
"IDE_TEST_DIR=\".\""
|
||||||
]
|
])
|
||||||
|
|
||||||
Depends { name: "cpp" }
|
Depends { name: "cpp" }
|
||||||
Depends { name: "Qt"; submodules: ["core", "widgets"] }
|
Depends { name: "Qt"; submodules: ["core", "widgets"] }
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import qbs.base 1.0
|
import qbs.base 1.0
|
||||||
import qbs.fileinfo 1.0 as FileInfo
|
import qbs.fileinfo 1.0 as FileInfo
|
||||||
|
import "../../qbs/defaults.js" as Defaults
|
||||||
|
|
||||||
Product {
|
Product {
|
||||||
type: ["dynamiclibrary", "pluginSpec"]
|
type: ["dynamiclibrary", "pluginSpec"]
|
||||||
@@ -21,7 +22,12 @@ Product {
|
|||||||
|
|
||||||
Depends { name: "pluginspec" }
|
Depends { name: "pluginspec" }
|
||||||
Depends { name: "cpp" }
|
Depends { name: "cpp" }
|
||||||
cpp.defines: [name.toUpperCase() + "_LIBRARY"]
|
Depends {
|
||||||
|
condition: Defaults.testsEnabled(qbs)
|
||||||
|
name: "Qt.test"
|
||||||
|
}
|
||||||
|
|
||||||
|
cpp.defines: Defaults.defines(qbs).concat([name.toUpperCase() + "_LIBRARY"])
|
||||||
cpp.rpaths: ["$ORIGIN/../../.."]
|
cpp.rpaths: ["$ORIGIN/../../.."]
|
||||||
cpp.linkerFlags: {
|
cpp.linkerFlags: {
|
||||||
if (qbs.buildVariant == "release" && (qbs.toolchain == "gcc" || qbs.toolchain == "mingw"))
|
if (qbs.buildVariant == "release" && (qbs.toolchain == "gcc" || qbs.toolchain == "mingw"))
|
||||||
@@ -33,4 +39,3 @@ Product {
|
|||||||
fileTags: ["pluginSpecIn"]
|
fileTags: ["pluginSpecIn"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ QtcPlugin {
|
|||||||
Depends { name: "TextEditor" }
|
Depends { name: "TextEditor" }
|
||||||
|
|
||||||
Depends { name: "cpp" }
|
Depends { name: "cpp" }
|
||||||
cpp.defines: [
|
cpp.defines: base.concat([
|
||||||
"ANALYZER_LIBRARY",
|
"ANALYZER_LIBRARY",
|
||||||
"QT_NO_CAST_FROM_ASCII"
|
"QT_NO_CAST_FROM_ASCII"
|
||||||
]
|
])
|
||||||
cpp.includePaths: [
|
cpp.includePaths: [
|
||||||
"..",
|
"..",
|
||||||
"../../libs",
|
"../../libs",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import qbs.base 1.0
|
import qbs.base 1.0
|
||||||
|
|
||||||
import "../QtcPlugin.qbs" as QtcPlugin
|
import "../QtcPlugin.qbs" as QtcPlugin
|
||||||
|
import "../../../qbs/defaults.js" as Defaults
|
||||||
|
|
||||||
QtcPlugin {
|
QtcPlugin {
|
||||||
name: "CppTools"
|
name: "CppTools"
|
||||||
@@ -107,6 +108,11 @@ QtcPlugin {
|
|||||||
"TypeHierarchyBuilder.h"
|
"TypeHierarchyBuilder.h"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Group {
|
||||||
|
condition: Defaults.testsEnabled(qbs)
|
||||||
|
files: ["cppcodegen_test.cpp", "cppcompletion_test.cpp"]
|
||||||
|
}
|
||||||
|
|
||||||
ProductModule {
|
ProductModule {
|
||||||
Depends { name: "CPlusPlus" }
|
Depends { name: "CPlusPlus" }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import qbs.base 1.0
|
import qbs.base 1.0
|
||||||
|
|
||||||
import "../QtcPlugin.qbs" as QtcPlugin
|
import "../QtcPlugin.qbs" as QtcPlugin
|
||||||
|
import "../../../qbs/defaults.js" as Defaults
|
||||||
|
|
||||||
QtcPlugin {
|
QtcPlugin {
|
||||||
name: "Debugger"
|
name: "Debugger"
|
||||||
@@ -19,7 +20,6 @@ QtcPlugin {
|
|||||||
Depends { name: "QtcSsh" }
|
Depends { name: "QtcSsh" }
|
||||||
|
|
||||||
Depends { name: "cpp" }
|
Depends { name: "cpp" }
|
||||||
cpp.defines: ["DEBUGGER_LIBRARY"]
|
|
||||||
cpp.includePaths: [
|
cpp.includePaths: [
|
||||||
".",
|
".",
|
||||||
"shared",
|
"shared",
|
||||||
@@ -33,7 +33,7 @@ QtcPlugin {
|
|||||||
]
|
]
|
||||||
|
|
||||||
Group {
|
Group {
|
||||||
condition: qbs.buildVariant === "debug"
|
condition: Defaults.testsEnabled(qbs)
|
||||||
qbs.installDir: "tests/manual/debugger/simple/"
|
qbs.installDir: "tests/manual/debugger/simple/"
|
||||||
fileTags: ["install"]
|
fileTags: ["install"]
|
||||||
files: ["../../../tests/manual/debugger/simple/simple.pro"]
|
files: ["../../../tests/manual/debugger/simple/simple.pro"]
|
||||||
@@ -314,4 +314,3 @@ QtcPlugin {
|
|||||||
cpp.includePaths: ["."]
|
cpp.includePaths: ["."]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import qbs.base 1.0
|
import qbs.base 1.0
|
||||||
|
|
||||||
import "../QtcPlugin.qbs" as QtcPlugin
|
import "../QtcPlugin.qbs" as QtcPlugin
|
||||||
|
import "../../../qbs/defaults.js" as Defaults
|
||||||
|
|
||||||
QtcPlugin {
|
QtcPlugin {
|
||||||
name: "FakeVim"
|
name: "FakeVim"
|
||||||
@@ -26,5 +27,9 @@ QtcPlugin {
|
|||||||
"fakevimplugin.h",
|
"fakevimplugin.h",
|
||||||
"fakevimoptions.ui"
|
"fakevimoptions.ui"
|
||||||
]
|
]
|
||||||
}
|
|
||||||
|
|
||||||
|
Group {
|
||||||
|
condition: Defaults.testsEnabled(qbs)
|
||||||
|
files: ["fakevim_test.cpp"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -24,10 +24,7 @@ QtcPlugin {
|
|||||||
condition: qtcore.versionMajor >= 5
|
condition: qtcore.versionMajor >= 5
|
||||||
cpp.defines: base.concat(["QT_NO_WEBKIT"])
|
cpp.defines: base.concat(["QT_NO_WEBKIT"])
|
||||||
}
|
}
|
||||||
cpp.defines: base.concat([
|
cpp.defines: base.concat(["QT_CLUCENE_SUPPORT"])
|
||||||
"QT_CLUCENE_SUPPORT",
|
|
||||||
"HELP_LIBRARY"
|
|
||||||
])
|
|
||||||
cpp.includePaths: [
|
cpp.includePaths: [
|
||||||
"../../shared/help",
|
"../../shared/help",
|
||||||
".",
|
".",
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import qbs.base 1.0
|
import qbs.base 1.0
|
||||||
import "../QtcPlugin.qbs" as QtcPlugin
|
import "../QtcPlugin.qbs" as QtcPlugin
|
||||||
|
import "../../../qbs/defaults.js" as Defaults
|
||||||
|
|
||||||
QtcPlugin {
|
QtcPlugin {
|
||||||
name: "ProjectExplorer"
|
name: "ProjectExplorer"
|
||||||
@@ -320,7 +321,7 @@ QtcPlugin {
|
|||||||
]
|
]
|
||||||
|
|
||||||
Group {
|
Group {
|
||||||
condition: qbs.targetOS == "windows"
|
condition: qbs.targetOS == "windows" || Defaults.testsEnabled(qbs)
|
||||||
files: [
|
files: [
|
||||||
"wincetoolchain.cpp",
|
"wincetoolchain.cpp",
|
||||||
"wincetoolchain.h",
|
"wincetoolchain.h",
|
||||||
@@ -335,6 +336,11 @@ QtcPlugin {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Group {
|
||||||
|
condition: Defaults.testsEnabled(qbs)
|
||||||
|
files: ["outputparser_test.h", "outputparser_test.cpp"]
|
||||||
|
}
|
||||||
|
|
||||||
ProductModule {
|
ProductModule {
|
||||||
Depends { name: "cpp" }
|
Depends { name: "cpp" }
|
||||||
Depends { name: "Qt"; submodules: ["network"] }
|
Depends { name: "Qt"; submodules: ["network"] }
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ QtcPlugin {
|
|||||||
Depends { name: "QtSupport" }
|
Depends { name: "QtSupport" }
|
||||||
|
|
||||||
Depends { name: "cpp" }
|
Depends { name: "cpp" }
|
||||||
cpp.defines: base.concat(project.additionalCppDefines.concat(["QWEAKPOINTER_ENABLE_ARROW"]))
|
cpp.defines: base.concat(["QWEAKPOINTER_ENABLE_ARROW"])
|
||||||
cpp.includePaths: [
|
cpp.includePaths: [
|
||||||
".",
|
".",
|
||||||
"designercore",
|
"designercore",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import qbs.base 1.0
|
import qbs.base 1.0
|
||||||
|
|
||||||
import "../QtcPlugin.qbs" as QtcPlugin
|
import "../QtcPlugin.qbs" as QtcPlugin
|
||||||
|
import "../../../qbs/defaults.js" as Defaults
|
||||||
|
|
||||||
QtcPlugin {
|
QtcPlugin {
|
||||||
name: "QmlJSTools"
|
name: "QmlJSTools"
|
||||||
@@ -59,6 +60,11 @@ QtcPlugin {
|
|||||||
"qmljssemanticinfo.h"
|
"qmljssemanticinfo.h"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Group {
|
||||||
|
condition: Defaults.testsEnabled(qbs)
|
||||||
|
files: ["qmljstools_test.cpp"]
|
||||||
|
}
|
||||||
|
|
||||||
ProductModule {
|
ProductModule {
|
||||||
Depends { name: "CppTools" }
|
Depends { name: "CppTools" }
|
||||||
Depends { name: "QmlDebug" }
|
Depends { name: "QmlDebug" }
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ QtcPlugin {
|
|||||||
Depends { name: "ProjectExplorer" }
|
Depends { name: "ProjectExplorer" }
|
||||||
|
|
||||||
Depends { name: "cpp" }
|
Depends { name: "cpp" }
|
||||||
cpp.defines: project.additionalCppDefines
|
|
||||||
cpp.includePaths: [
|
cpp.includePaths: [
|
||||||
"..",
|
"..",
|
||||||
"../../libs",
|
"../../libs",
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import qbs.base 1.0
|
import qbs.base 1.0
|
||||||
|
import "../../qbs/defaults.js" as Defaults
|
||||||
|
|
||||||
Application {
|
Application {
|
||||||
Depends { name: "cpp" }
|
Depends { name: "cpp" }
|
||||||
|
cpp.defines: Defaults.defines(qbs)
|
||||||
cpp.linkerFlags: {
|
cpp.linkerFlags: {
|
||||||
if (qbs.buildVariant == "release" && (qbs.toolchain == "gcc" || qbs.toolchain == "mingw"))
|
if (qbs.buildVariant == "release" && (qbs.toolchain == "gcc" || qbs.toolchain == "mingw"))
|
||||||
return ["-Wl,-s"]
|
return ["-Wl,-s"]
|
||||||
|
|||||||
Reference in New Issue
Block a user