diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-09-26 08:43:55 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-09-26 08:44:32 +0200 |
commit | 86d69f208f93f048d858125299b9b2639a1f146a (patch) | |
tree | ccc6f3a1960d667e395a5b8fb261589188a965a6 | |
parent | b6a5e43c143dab4bec349fb97d4a6c5589475197 (diff) | |
parent | 70be4ec8d868a5f721c3d1e48b2e527da7178f26 (diff) |
Merge remote-tracking branch 'origin/1.9'
Change-Id: I40c1ea23e7351deac715958783158c089e65a02d
-rw-r--r-- | doc/qbs.qdoc | 2 | ||||
-rw-r--r-- | docker/windowsservercore/Dockerfile | 2 | ||||
-rw-r--r-- | examples/cocoa-application/app.qbs | 2 | ||||
-rw-r--r-- | examples/cocoa-touch-application/CocoaTouchApplication.qbs | 2 | ||||
-rw-r--r-- | examples/install-bundle/Storyboard.storyboard | 1 | ||||
-rw-r--r-- | examples/install-bundle/install-bundle.qbs | 2 | ||||
-rw-r--r-- | qbs-resources/imports/QbsApp.qbs | 2 | ||||
-rw-r--r-- | share/qbs/imports/qbs/DarwinTools/darwin-tools.js | 161 | ||||
-rw-r--r-- | share/qbs/imports/qbs/ModUtils/utils.js | 3 | ||||
-rw-r--r-- | share/qbs/modules/bundle/BundleModule.qbs | 17 | ||||
-rw-r--r-- | tests/auto/api/testdata/precompiled-header/main.cpp | 55 | ||||
-rw-r--r-- | tests/auto/api/testdata/precompiled-header/myobject.cpp | 41 | ||||
-rw-r--r-- | tests/auto/api/testdata/precompiled-header/myobject.h | 43 | ||||
-rw-r--r-- | tests/auto/api/testdata/precompiled-header/precompiled-header.qbs | 15 | ||||
-rw-r--r-- | tests/auto/api/testdata/precompiled-header/stable.h | 37 |
15 files changed, 113 insertions, 272 deletions
diff --git a/doc/qbs.qdoc b/doc/qbs.qdoc index 73d2e6929..0be7781d5 100644 --- a/doc/qbs.qdoc +++ b/doc/qbs.qdoc @@ -779,7 +779,7 @@ property string warningLevel property string optimization property bool debugInformation - property path precompiledHeader + property pathList includePaths // ... FileTagger { patterns: "*.cpp" diff --git a/docker/windowsservercore/Dockerfile b/docker/windowsservercore/Dockerfile index 561116c3f..d3c7c1afd 100644 --- a/docker/windowsservercore/Dockerfile +++ b/docker/windowsservercore/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/windowsservercore:10.0.14393.1480 +FROM microsoft/windowsservercore:10.0.14393.1715 LABEL Description="Windows Server Core development environment for Qbs with Qt 5.9, Chocolatey and various dependencies for testing Qbs modules and functionality" # Disable crash dialog for release-mode runtimes diff --git a/examples/cocoa-application/app.qbs b/examples/cocoa-application/app.qbs index 6416435c0..f51f94e8b 100644 --- a/examples/cocoa-application/app.qbs +++ b/examples/cocoa-application/app.qbs @@ -56,7 +56,7 @@ CppApplication { name: "Cocoa Application" cpp.useObjcPrecompiledHeader: true - + cpp.minimumMacosVersion: "10.8" cpp.frameworks: ["Cocoa"] Group { diff --git a/examples/cocoa-touch-application/CocoaTouchApplication.qbs b/examples/cocoa-touch-application/CocoaTouchApplication.qbs index b0bdf2446..9a1046611 100644 --- a/examples/cocoa-touch-application/CocoaTouchApplication.qbs +++ b/examples/cocoa-touch-application/CocoaTouchApplication.qbs @@ -57,7 +57,7 @@ CppApplication { name: "Cocoa Touch Application" cpp.useObjcPrecompiledHeader: true - + cpp.minimumIosVersion: "6.1" cpp.frameworks: [ "UIKit", "Foundation", "CoreGraphics" ] Group { diff --git a/examples/install-bundle/Storyboard.storyboard b/examples/install-bundle/Storyboard.storyboard index 41510ae29..06aef2bcf 100644 --- a/examples/install-bundle/Storyboard.storyboard +++ b/examples/install-bundle/Storyboard.storyboard @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="8152.3" systemVersion="14E46" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <dependencies> - <deployment version="0.0" identifier="macosx"/> <development version="5100" identifier="xcode"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8152.3"/> </dependencies> diff --git a/examples/install-bundle/install-bundle.qbs b/examples/install-bundle/install-bundle.qbs index 3151f5517..7ec4e8f78 100644 --- a/examples/install-bundle/install-bundle.qbs +++ b/examples/install-bundle/install-bundle.qbs @@ -19,6 +19,8 @@ Project { "Storyboard.storyboard" ] + cpp.minimumMacosVersion: "10.10" + Group { fileTagsFilter: isBundle ? ["bundle.content"] : ["application"] qbs.install: true diff --git a/qbs-resources/imports/QbsApp.qbs b/qbs-resources/imports/QbsApp.qbs index f252b336c..15afa7cef 100644 --- a/qbs-resources/imports/QbsApp.qbs +++ b/qbs-resources/imports/QbsApp.qbs @@ -4,7 +4,9 @@ import qbs.FileInfo QbsProduct { Depends { name: "qbscore" } Depends { name: "cpp" } + Depends { name: "qbsversion" } type: "application" + version: qbsversion.version consoleApplication: true destinationDirectory: "bin" cpp.includePaths: [ diff --git a/share/qbs/imports/qbs/DarwinTools/darwin-tools.js b/share/qbs/imports/qbs/DarwinTools/darwin-tools.js index b0f0bdc52..95e8dab25 100644 --- a/share/qbs/imports/qbs/DarwinTools/darwin-tools.js +++ b/share/qbs/imports/qbs/DarwinTools/darwin-tools.js @@ -139,87 +139,104 @@ function _resourceFileProperties(path) { return [ undefined, '.' ]; } -/** - * Recursively perform variable replacements in an environment dictionary. - * - * JSON.stringify(expandPlistEnvironmentVariables({a:"$(x)3$$(y)",b:{t:"%$(y) $(k)"}}, - * {x:"X",y:"Y"}, true)) - * Warning undefined variable k in variable expansion - * => {"a":"X3$Y","b":{"t":"%Y $(k)"}} - */ -function expandPlistEnvironmentVariables(obj, env, warn) { - // Possible syntaxes for wrapping an environment variable name - var syntaxes = [ - {"open": "${", "close": "}"}, - {"open": "$(", "close": ")"}, - {"open": "@", "close": "@"} - ]; - +var PropertyListVariableExpander = (function () { + function PropertyListVariableExpander() { + } /** - * Finds the first index of a replacement starting with one of the supported syntaxes - * This is needed so we don't do recursive substitutions + * Recursively perform variable replacements in an environment dictionary. */ - function indexOfReplacementStart(syntaxes, str, offset) { - var syntax; - var idx = str.length; - for (var i in syntaxes) { - var j = str.indexOf(syntaxes[i].open, offset); - if (j !== -1 && j < idx) { - syntax = syntaxes[i]; - idx = j; + PropertyListVariableExpander.prototype.expand = function (obj, env) { + var $this = this; + + // Possible syntaxes for wrapping an environment variable name + var syntaxes = [ + {"open": "${", "close": "}"}, + {"open": "$(", "close": ")"}, + {"open": "@", "close": "@"} + ]; + + /** + * Finds the first index of a replacement starting with one of the supported syntaxes + * This is needed so we don't do recursive substitutions + */ + function indexOfReplacementStart(syntaxes, str, offset) { + var syntax; + var idx = str.length; + for (var i in syntaxes) { + var j = str.indexOf(syntaxes[i].open, offset); + if (j !== -1 && j < idx) { + syntax = syntaxes[i]; + idx = j; + } } + return { "syntax": syntax, "index": idx === str.length ? -1 : idx }; } - return { "syntax": syntax, "index": idx === str.length ? -1 : idx }; - } - function expandRecursive(obj, env, checked) { - checked.push(obj); - for (var key in obj) { - var value = obj[key]; - var type = typeof(value); - if (type === "object") { - if (checked.indexOf(value) !== -1) + function expandRecursive(obj, env, checked) { + checked.push(obj); + for (var key in obj) { + var value = obj[key]; + var type = typeof(value); + if (type === "object") { + if (checked.indexOf(value) !== -1) + continue; + expandRecursive(value, env, checked); + } + if (type !== "string") continue; - expandRecursive(value, env, checked); - } - if (type !== "string") - continue; - var repl = indexOfReplacementStart(syntaxes, value); - var i = repl.index; - var changes = false; - while (i !== -1) { - var j = value.indexOf(repl.syntax.close, i + repl.syntax.open.length); - if (j === -1) - break; - var varParts = value.slice(i + repl.syntax.open.length, j).split(':'); - var varName = varParts[0]; - var varFormatter = varParts[1]; - var varValue = env[varName]; - if (undefined === varValue) { - // skip replacement - if (warn) - console.warn("undefined variable " + varName + " in variable expansion"); - i = j + repl.syntax.close.length; - } else { - changes = true; - varValue = String(varValue); - if (varFormatter !== undefined) - varFormatter = varFormatter.toLowerCase(); - if (varFormatter === "rfc1034identifier") - varValue = Utilities.rfc1034Identifier(varValue); - value = value.slice(0, i) + varValue + value.slice(j + repl.syntax.close.length); - // avoid recursive substitutions to avoid potentially infinite loops - i += varValue.length; + var repl = indexOfReplacementStart(syntaxes, value); + var i = repl.index; + var changes = false; + while (i !== -1) { + var j = value.indexOf(repl.syntax.close, i + repl.syntax.open.length); + if (j === -1) + break; + var varParts = value.slice(i + repl.syntax.open.length, j).split(':'); + var varName = varParts[0]; + var varFormatter = varParts[1]; + var varValue = env[varName]; + if (undefined === varValue) { + // skip replacement + if ($this.undefinedVariableFunction) + $this.undefinedVariableFunction(key, varName); + i = j + repl.syntax.close.length; + } else { + changes = true; + varValue = String(varValue); + if (varFormatter !== undefined) + varFormatter = varFormatter.toLowerCase(); + if (varFormatter === "rfc1034identifier") + varValue = Utilities.rfc1034Identifier(varValue); + value = value.slice(0, i) + varValue + value.slice(j + repl.syntax.close.length); + // avoid recursive substitutions to avoid potentially infinite loops + i += varValue.length; + } + repl = indexOfReplacementStart(syntaxes, value, i); + i = repl.index; } - repl = indexOfReplacementStart(syntaxes, value, i); - i = repl.index; + if (changes) + obj[key] = value; } - if (changes) - obj[key] = value; } - } - expandRecursive(obj, env, []); - return obj; + expandRecursive(obj, env, []); + return obj; + }; + return PropertyListVariableExpander; +}()); + +/** + * JSON.stringify(expandPlistEnvironmentVariables({a:"$(x)3$$(y)",b:{t:"%$(y) $(k)"}}, + * {x:"X",y:"Y"}, true)) + * Warning undefined variable k in variable expansion + * => {"a":"X3$Y","b":{"t":"%Y $(k)"}} + */ +function expandPlistEnvironmentVariables(obj, env, warn) { + var expander = new PropertyListVariableExpander(); + expander.undefinedVariableFunction = function (key, varName) { + if (warn) + console.warn("undefined variable " + varName + " in variable expansion"); + }; + return expander.expand(obj, env); } /** diff --git a/share/qbs/imports/qbs/ModUtils/utils.js b/share/qbs/imports/qbs/ModUtils/utils.js index 862d22a97..9de6a92c6 100644 --- a/share/qbs/imports/qbs/ModUtils/utils.js +++ b/share/qbs/imports/qbs/ModUtils/utils.js @@ -128,9 +128,6 @@ function fileTagForTargetLanguage(fileTags) { * for that property, and the base property name. * * If \a fileTag is undefined, the language-agnostic property name is returned. - * - * @param propertyName flags, platformFlags, precompiledHeader - * @param fileTag c, cpp, objc, objcpp */ function languagePropertyName(propertyName, fileTag) { if (!fileTag) diff --git a/share/qbs/modules/bundle/BundleModule.qbs b/share/qbs/modules/bundle/BundleModule.qbs index e9f9128e2..b7f38559c 100644 --- a/share/qbs/modules/bundle/BundleModule.qbs +++ b/share/qbs/modules/bundle/BundleModule.qbs @@ -395,7 +395,22 @@ Module { for (key in qmakeEnv) env[key] = qmakeEnv[key]; - DarwinTools.expandPlistEnvironmentVariables(aggregatePlist, env, true); + var expander = new DarwinTools.PropertyListVariableExpander(); + expander.undefinedVariableFunction = function (key, varName) { + var msg = "Info.plist variable expansion encountered undefined variable '" + + varName + "' when expanding value for key '" + key + + "', defined in one of the following files:\n\t"; + var allFilePaths = []; + for (i in infoPlistFiles) + allFilePaths.push(infoPlistFiles[i].filePath); + if (platformInfoPlist) + allFilePaths.push(platformInfoPlist); + msg += allFilePaths.join("\n\t") + "\n"; + msg += "or in the bundle.infoPlist property of product '" + + product.name + "'"; + console.warn(msg); + }; + aggregatePlist = expander.expand(aggregatePlist, env); // Add keys from partial Info.plists from asset catalogs, XIBs, and storyboards for (i in partialInfoPlistFiles) { diff --git a/tests/auto/api/testdata/precompiled-header/main.cpp b/tests/auto/api/testdata/precompiled-header/main.cpp deleted file mode 100644 index b719b42e3..000000000 --- a/tests/auto/api/testdata/precompiled-header/main.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qbs. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "myobject.h" -#include <algorithm> -#include <iostream> -#include <list> - -using namespace std; - -int main() -{ - MyObject obj; - list<int> lst; - lst.push_back(1); - lst.push_back(2); - lst.push_back(3); - lst.push_back(4); - lst.push_back(5); - lst.push_back(6); - lst.push_back(7); - lst.push_back(8); - lst.push_back(9); - reverse(lst.begin(), lst.end()); - for (list<int>::iterator it=lst.begin(); it != lst.end(); ++it) - cout << *it << ", "; - cout << endl; - return 0; -} - diff --git a/tests/auto/api/testdata/precompiled-header/myobject.cpp b/tests/auto/api/testdata/precompiled-header/myobject.cpp deleted file mode 100644 index 018b91e9d..000000000 --- a/tests/auto/api/testdata/precompiled-header/myobject.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qbs. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <iostream> -#include "myobject.h" - -MyObject::MyObject() -{ - std::cout << "MyObject::MyObject()\n"; -} - -MyObject::~MyObject() -{ - std::cout << "MyObject::~MyObject()" << std::endl; -} - diff --git a/tests/auto/api/testdata/precompiled-header/myobject.h b/tests/auto/api/testdata/precompiled-header/myobject.h deleted file mode 100644 index a84536002..000000000 --- a/tests/auto/api/testdata/precompiled-header/myobject.h +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qbs. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MYOBJECT_H -#define MYOBJECT_H - -#include <QtCore/QObject> - -class MyObject : public QObject -{ - Q_OBJECT -public: - MyObject(); - ~MyObject(); -}; - -#endif - diff --git a/tests/auto/api/testdata/precompiled-header/precompiled-header.qbs b/tests/auto/api/testdata/precompiled-header/precompiled-header.qbs deleted file mode 100644 index 5f7b4b616..000000000 --- a/tests/auto/api/testdata/precompiled-header/precompiled-header.qbs +++ /dev/null @@ -1,15 +0,0 @@ -import qbs 1.0 - -Product { - type: "application" - consoleApplication: true - name: "MyApp" - files: ["stable.h", - "myobject.h", - "main.cpp", - "myobject.cpp"] - Depends { name: "cpp" } - cpp.precompiledHeader: "stable.h" - Depends { name: "Qt.core" } -} - diff --git a/tests/auto/api/testdata/precompiled-header/stable.h b/tests/auto/api/testdata/precompiled-header/stable.h deleted file mode 100644 index d9a6222dd..000000000 --- a/tests/auto/api/testdata/precompiled-header/stable.h +++ /dev/null @@ -1,37 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qbs. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* Add C includes here */ - -#if defined __cplusplus -/* Add C++ includes here */ - -# include <iostream> -# include <algorithm> -#endif - |