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.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 { ...@@ -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"]
......
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 { ...@@ -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"] }
......
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 { ...@@ -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 { ...@@ -33,4 +39,3 @@ Product {
fileTags: ["pluginSpecIn"] fileTags: ["pluginSpecIn"]
} }
} }
...@@ -13,10 +13,10 @@ QtcPlugin { ...@@ -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",
......
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 { ...@@ -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" }
} }
......
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 { ...@@ -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 { ...@@ -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 { ...@@ -314,4 +314,3 @@ QtcPlugin {
cpp.includePaths: ["."] cpp.includePaths: ["."]
} }
} }
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 { ...@@ -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 { ...@@ -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",
".", ".",
......
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 { ...@@ -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 { ...@@ -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 { ...@@ -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",
......
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 { ...@@ -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 { ...@@ -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",
......
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"]
......
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