Commit 40d919ee authored by Christian Kandeler's avatar Christian Kandeler Committed by Joerg Bornemann

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: default avatarJoerg Bornemann <joerg.bornemann@nokia.com>
parent 405217c1
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
}
import qbs.base 1.0
import qbs.fileinfo 1.0 as FileInfo
import "qbs/defaults.js" as Defaults
Project {
property string ide_version_major: '2'
property string ide_version_minor: '6'
property string ide_version_release: '81'
property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release
property var additionalCppDefines: [ 'IDE_LIBRARY_BASENAME="lib"' ]
moduleSearchPaths: "qbs"
references: [
......@@ -135,7 +135,7 @@ Project {
consoleApplication: qbs.debugInformation
cpp.rpaths: ["$ORIGIN/../lib/qtcreator"]
cpp.defines: project.additionalCppDefines
cpp.defines: Defaults.defines(qbs)
cpp.linkerFlags: {
if (qbs.buildVariant == "release" && (qbs.toolchain == "gcc" || qbs.toolchain == "mingw"))
return ["-Wl,-s"]
......
import qbs.base 1.0
import "../../qbs/defaults.js" as Defaults
DynamicLibrary {
Depends { name: "cpp" }
Depends {
condition: Defaults.testsEnabled(qbs)
name: "Qt.test"
}
cpp.defines: Defaults.defines(qbs)
cpp.linkerFlags: {
if (qbs.buildVariant == "release" && (qbs.toolchain == "gcc" || qbs.toolchain == "mingw"))
return ["-Wl,-s"]
......
......@@ -8,10 +8,10 @@ QtcLibrary {
".",
".."
]
cpp.defines: [
cpp.defines: base.concat([
"EXTENSIONSYSTEM_LIBRARY",
"IDE_TEST_DIR=\".\""
]
])
Depends { name: "cpp" }
Depends { name: "Qt"; submodules: ["core", "widgets"] }
......
import qbs.base 1.0
import qbs.fileinfo 1.0 as FileInfo
import "../../qbs/defaults.js" as Defaults
Product {
type: ["dynamiclibrary", "pluginSpec"]
......@@ -21,7 +22,12 @@ Product {
Depends { name: "pluginspec" }
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.linkerFlags: {
if (qbs.buildVariant == "release" && (qbs.toolchain == "gcc" || qbs.toolchain == "mingw"))
......@@ -33,4 +39,3 @@ Product {
fileTags: ["pluginSpecIn"]
}
}
......@@ -13,10 +13,10 @@ QtcPlugin {
Depends { name: "TextEditor" }
Depends { name: "cpp" }
cpp.defines: [
cpp.defines: base.concat([
"ANALYZER_LIBRARY",
"QT_NO_CAST_FROM_ASCII"
]
])
cpp.includePaths: [
"..",
"../../libs",
......
import qbs.base 1.0
import "../QtcPlugin.qbs" as QtcPlugin
import "../../../qbs/defaults.js" as Defaults
QtcPlugin {
name: "CppTools"
......@@ -107,6 +108,11 @@ QtcPlugin {
"TypeHierarchyBuilder.h"
]
Group {
condition: Defaults.testsEnabled(qbs)
files: ["cppcodegen_test.cpp", "cppcompletion_test.cpp"]
}
ProductModule {
Depends { name: "CPlusPlus" }
}
......
import qbs.base 1.0
import "../QtcPlugin.qbs" as QtcPlugin
import "../../../qbs/defaults.js" as Defaults
QtcPlugin {
name: "Debugger"
......@@ -19,7 +20,6 @@ QtcPlugin {
Depends { name: "QtcSsh" }
Depends { name: "cpp" }
cpp.defines: ["DEBUGGER_LIBRARY"]
cpp.includePaths: [
".",
"shared",
......@@ -33,7 +33,7 @@ QtcPlugin {
]
Group {
condition: qbs.buildVariant === "debug"
condition: Defaults.testsEnabled(qbs)
qbs.installDir: "tests/manual/debugger/simple/"
fileTags: ["install"]
files: ["../../../tests/manual/debugger/simple/simple.pro"]
......@@ -314,4 +314,3 @@ QtcPlugin {
cpp.includePaths: ["."]
}
}
import qbs.base 1.0
import "../QtcPlugin.qbs" as QtcPlugin
import "../../../qbs/defaults.js" as Defaults
QtcPlugin {
name: "FakeVim"
......@@ -26,5 +27,9 @@ QtcPlugin {
"fakevimplugin.h",
"fakevimoptions.ui"
]
}
Group {
condition: Defaults.testsEnabled(qbs)
files: ["fakevim_test.cpp"]
}
}
......@@ -24,10 +24,7 @@ QtcPlugin {
condition: qtcore.versionMajor >= 5
cpp.defines: base.concat(["QT_NO_WEBKIT"])
}
cpp.defines: base.concat([
"QT_CLUCENE_SUPPORT",
"HELP_LIBRARY"
])
cpp.defines: base.concat(["QT_CLUCENE_SUPPORT"])
cpp.includePaths: [
"../../shared/help",
".",
......
import qbs.base 1.0
import "../QtcPlugin.qbs" as QtcPlugin
import "../../../qbs/defaults.js" as Defaults
QtcPlugin {
name: "ProjectExplorer"
......@@ -320,7 +321,7 @@ QtcPlugin {
]
Group {
condition: qbs.targetOS == "windows"
condition: qbs.targetOS == "windows" || Defaults.testsEnabled(qbs)
files: [
"wincetoolchain.cpp",
"wincetoolchain.h",
......@@ -335,6 +336,11 @@ QtcPlugin {
]
}
Group {
condition: Defaults.testsEnabled(qbs)
files: ["outputparser_test.h", "outputparser_test.cpp"]
}
ProductModule {
Depends { name: "cpp" }
Depends { name: "Qt"; submodules: ["network"] }
......
......@@ -20,7 +20,7 @@ QtcPlugin {
Depends { name: "QtSupport" }
Depends { name: "cpp" }
cpp.defines: base.concat(project.additionalCppDefines.concat(["QWEAKPOINTER_ENABLE_ARROW"]))
cpp.defines: base.concat(["QWEAKPOINTER_ENABLE_ARROW"])
cpp.includePaths: [
".",
"designercore",
......
import qbs.base 1.0
import "../QtcPlugin.qbs" as QtcPlugin
import "../../../qbs/defaults.js" as Defaults
QtcPlugin {
name: "QmlJSTools"
......@@ -59,6 +60,11 @@ QtcPlugin {
"qmljssemanticinfo.h"
]
Group {
condition: Defaults.testsEnabled(qbs)
files: ["qmljstools_test.cpp"]
}
ProductModule {
Depends { name: "CppTools" }
Depends { name: "QmlDebug" }
......
......@@ -10,7 +10,6 @@ QtcPlugin {
Depends { name: "ProjectExplorer" }
Depends { name: "cpp" }
cpp.defines: project.additionalCppDefines
cpp.includePaths: [
"..",
"../../libs",
......
import qbs.base 1.0
import "../../qbs/defaults.js" as Defaults
Application {
Depends { name: "cpp" }
cpp.defines: Defaults.defines(qbs)
cpp.linkerFlags: {
if (qbs.buildVariant == "release" && (qbs.toolchain == "gcc" || qbs.toolchain == "mingw"))
return ["-Wl,-s"]
......
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