forked from qt-creator/qt-creator
AutoTest: Update Qbs/GTest wizard
Instead of using undefined objects pass the needed objects around to access them inside the JavaScript file. Also update deprecated function use. Change-Id: I4c0cafc319047d0b72a0f9310e5335f793f800ac Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -13,9 +13,9 @@
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
**/
|
||||
var FileInfo = loadExtension("qbs.FileInfo")
|
||||
var FileInfo = require("qbs.FileInfo")
|
||||
|
||||
function getGTestDir(str) {
|
||||
function getGTestDir(qbs, str) {
|
||||
if (!str) {
|
||||
if (qbs.hostOS.contains("linux"))
|
||||
return "/usr/include/gtest";
|
||||
@@ -25,7 +25,7 @@ function getGTestDir(str) {
|
||||
return "";
|
||||
}
|
||||
|
||||
function getGMockDir(str) {
|
||||
function getGMockDir(qbs, str) {
|
||||
if (!str) {
|
||||
if (qbs.hostOS.contains("linux"))
|
||||
return "/usr/include/gmock";
|
||||
@@ -35,29 +35,29 @@ function getGMockDir(str) {
|
||||
return "";
|
||||
}
|
||||
|
||||
function getGTestAll(str) {
|
||||
var gtest = getGTestDir(str);
|
||||
function getGTestAll(qbs, str) {
|
||||
var gtest = getGTestDir(qbs, str);
|
||||
if (!gtest)
|
||||
return [];
|
||||
return [FileInfo.joinPaths(gtest, "src/gtest-all.cc")];
|
||||
}
|
||||
|
||||
function getGMockAll(str) {
|
||||
var gmock = getGMockDir(str);
|
||||
function getGMockAll(qbs, str) {
|
||||
var gmock = getGMockDir(qbs, str);
|
||||
if (!gmock)
|
||||
return [];
|
||||
return [FileInfo.joinPaths(gmock, "src/gmock-all.cc")];
|
||||
}
|
||||
|
||||
function getGTestIncludes(str) {
|
||||
var gtest = getGTestDir(str);
|
||||
function getGTestIncludes(qbs, str) {
|
||||
var gtest = getGTestDir(qbs, str);
|
||||
if (!gtest)
|
||||
return [];
|
||||
return [gtest, FileInfo.joinPaths(gtest, "include")];
|
||||
}
|
||||
|
||||
function getGMockIncludes(str) {
|
||||
var mock = getGMockDir(str);
|
||||
function getGMockIncludes(qbs, str) {
|
||||
var mock = getGMockDir(qbs, str);
|
||||
if (!mock)
|
||||
return [];
|
||||
return [mock, FileInfo.joinPaths(mock, "include")];
|
||||
|
@@ -43,14 +43,14 @@ CppApplication {
|
||||
}
|
||||
|
||||
|
||||
cpp.includePaths: [].concat(googleCommon.getGTestIncludes(googletestDir))
|
||||
.concat(googleCommon.getGMockIncludes(googletestDir))
|
||||
cpp.includePaths: [].concat(googleCommon.getGTestIncludes(qbs, googletestDir))
|
||||
.concat(googleCommon.getGMockIncludes(qbs, googletestDir))
|
||||
|
||||
files: [
|
||||
"%{MainCppName}",
|
||||
"%{TestCaseFileWithHeaderSuffix}",
|
||||
].concat(googleCommon.getGTestAll(googletestDir))
|
||||
.concat(googleCommon.getGMockAll(googletestDir))
|
||||
].concat(googleCommon.getGTestAll(qbs, googletestDir))
|
||||
.concat(googleCommon.getGMockAll(qbs, googletestDir))
|
||||
@endif
|
||||
@if "%{TestFrameWork}" == "QtQuickTest"
|
||||
Depends { name: "cpp" }
|
||||
|
Reference in New Issue
Block a user