aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/corelib/buildgraph/executor.cpp21
-rw-r--r--src/lib/corelib/corelib.qbs4
-rw-r--r--src/lib/corelib/language/moduleloader.cpp5
-rw-r--r--src/lib/corelib/language/projectresolver.cpp16
-rw-r--r--src/lib/corelib/language/scriptengine.cpp7
-rw-r--r--src/lib/qtprofilesetup/templates/qmlcache.qbs26
-rw-r--r--src/lib/scriptengine/include/QtScript/qtscriptglobal.h46
-rw-r--r--src/lib/scriptengine/scriptengine.pro1
-rw-r--r--src/lib/scriptengine/scriptengine.qbs11
-rw-r--r--src/lib/scriptengine/use_scriptengine.pri1
10 files changed, 116 insertions, 22 deletions
diff --git a/src/lib/corelib/buildgraph/executor.cpp b/src/lib/corelib/buildgraph/executor.cpp
index 24f484ad2..8713b9b41 100644
--- a/src/lib/corelib/buildgraph/executor.cpp
+++ b/src/lib/corelib/buildgraph/executor.cpp
@@ -771,8 +771,7 @@ void Executor::rescueOldBuildData(Artifact *artifact, bool *childrenAdded = 0)
return;
qCDebug(lcBuildGraph) << "Attempting to rescue data of artifact" << artifact->fileName();
- typedef std::pair<Artifact *, bool> ChildArtifactData;
- QList<ChildArtifactData> childrenToConnect;
+ std::vector<Artifact *> childrenToConnect;
bool canRescue = artifact->transformer->commands == rad.commands;
if (canRescue) {
ResolvedProductPtr pseudoProduct = ResolvedProduct::create();
@@ -796,10 +795,15 @@ void Executor::rescueOldBuildData(Artifact *artifact, bool *childrenAdded = 0)
removeGeneratedArtifactFromDisk(cd.childFilePath, m_logger);
}
}
- // TODO: Shouldn't addedByScanner always be true here? Otherwise the child would be
- // in the list already, no?
+ if (!cd.addedByScanner) {
+ // If an artifact has disappeared from the list of children, the commands
+ // might need to run again.
+ canRescue = false;
+ qCDebug(lcBuildGraph) << "Former child artifact" << cd.childFilePath <<
+ "is no longer in the list of children";
+ }
if (canRescue)
- childrenToConnect.push_back({child, cd.addedByScanner});
+ childrenToConnect.push_back(child);
}
for (const QString &depPath : rad.fileDependencies) {
const QList<FileResourceBase *> depList = m_project->buildData->lookupFiles(depPath);
@@ -865,10 +869,9 @@ void Executor::rescueOldBuildData(Artifact *artifact, bool *childrenAdded = 0)
artifact->knownOutOfDate = artifact->knownOutOfDate || rad.knownOutOfDate;
if (childrenAdded && !childrenToConnect.empty())
*childrenAdded = true;
- for (const ChildArtifactData &cad : qAsConst(childrenToConnect)) {
- safeConnect(artifact, cad.first);
- if (cad.second)
- artifact->childrenAddedByScanner << cad.first;
+ for (Artifact * const child : childrenToConnect) {
+ safeConnect(artifact, child);
+ artifact->childrenAddedByScanner << child;
}
qCDebug(lcBuildGraph) << "Data was rescued.";
} else {
diff --git a/src/lib/corelib/corelib.qbs b/src/lib/corelib/corelib.qbs
index fd25d30e0..08733b624 100644
--- a/src/lib/corelib/corelib.qbs
+++ b/src/lib/corelib/corelib.qbs
@@ -17,7 +17,9 @@ QbsLibrary {
Depends { condition: qbsbuildconfig.enableProjectFileUpdates; name: "Qt.gui" }
Depends { condition: staticBuild; productTypes: ["qbsplugin"] }
name: "qbscore"
- cpp.includePaths: base.concat([
+ property stringList bundledQtScriptIncludes: qbsbuildconfig.useBundledQtScript
+ || !Qt.script.present ? qbsscriptengine.includePaths : []
+ cpp.includePaths: base.concat(bundledQtScriptIncludes).concat([
".",
"../.." // for the plugin headers
])
diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp
index 933c49abc..df47e36ea 100644
--- a/src/lib/corelib/language/moduleloader.cpp
+++ b/src/lib/corelib/language/moduleloader.cpp
@@ -581,6 +581,8 @@ void ModuleLoader::handleTopLevelProject(ModuleLoaderResult *loadResult, Item *p
for (ProductContext * const p : productSorter.sortedProducts()) {
try {
handleProduct(p);
+ if (p->name.startsWith(shadowProductPrefix()))
+ tlp.probes << p->info.probes;
} catch (const ErrorInfo &err) {
handleProductError(err, p);
}
@@ -3418,7 +3420,8 @@ void ModuleLoader::resolveProbe(ProductContext *productContext, Item *parent, It
const bool condition = m_evaluator->boolValue(probe, StringConstants::conditionProperty());
const QString &sourceCode = configureScript->sourceCode().toString();
ProbeConstPtr resolvedProbe;
- if (parent->type() == ItemType::Project) {
+ if (parent->type() == ItemType::Project
+ || productContext->name.startsWith(shadowProductPrefix())) {
resolvedProbe = findOldProjectProbe(probeId, condition, initialProperties, sourceCode);
} else {
const QString &uniqueProductName = productContext->uniqueName();
diff --git a/src/lib/corelib/language/projectresolver.cpp b/src/lib/corelib/language/projectresolver.cpp
index b7535c2eb..ff74f845a 100644
--- a/src/lib/corelib/language/projectresolver.cpp
+++ b/src/lib/corelib/language/projectresolver.cpp
@@ -1682,7 +1682,21 @@ void ProjectResolver::evaluateProperty(const Item *item, const QString &propName
// NOTE: Loses type information if scriptValue.isUndefined == true,
// as such QScriptValues become invalid QVariants.
- QVariant v = scriptValue.isFunction() ? scriptValue.toString() : scriptValue.toVariant();
+ QVariant v;
+ if (scriptValue.isFunction()) {
+ v = scriptValue.toString();
+ } else {
+ v = scriptValue.toVariant();
+ QVariantMap m = v.toMap();
+ if (m.contains(StringConstants::importScopeNamePropertyInternal())) {
+ QVariantMap tmp = m;
+ m = scriptValue.prototype().toVariant().toMap();
+ for (auto it = tmp.begin(); it != tmp.end(); ++it)
+ m.insert(it.key(), it.value());
+ v = m;
+ }
+ }
+
if (pd.type() == PropertyDeclaration::Path && v.isValid()) {
v = v.toString();
} else if (pd.type() == PropertyDeclaration::PathList
diff --git a/src/lib/corelib/language/scriptengine.cpp b/src/lib/corelib/language/scriptengine.cpp
index 568a927b2..e983ae945 100644
--- a/src/lib/corelib/language/scriptengine.cpp
+++ b/src/lib/corelib/language/scriptengine.cpp
@@ -152,6 +152,7 @@ void ScriptEngine::import(const FileContextBaseConstPtr &fileCtx, QScriptValue &
if (m_observeMode == ObserveMode::Enabled) {
for (QScriptValue &sv : m_requireResults)
observeImport(sv);
+ m_requireResults.clear();
}
m_currentDirPathStack.pop();
@@ -507,8 +508,7 @@ QScriptValue ScriptEngine::js_require(QScriptContext *context, QScriptEngine *qt
if (!values.empty()) {
const QScriptValue mergedValue = mergeExtensionObjects(values);
- if (engine->m_observeMode == ObserveMode::Enabled)
- engine->m_requireResults.push_back(mergedValue);
+ engine->m_requireResults.push_back(mergedValue);
engine->m_filePathsPerImport[mergedValue.objectId()] = filePaths;
return mergedValue;
}
@@ -533,8 +533,7 @@ QScriptValue ScriptEngine::js_require(QScriptContext *context, QScriptEngine *qt
const QString scopeName = scopeNamePrefix + QString::number(qHash(filePath), 16);
result.setProperty(StringConstants::importScopeNamePropertyInternal(), scopeName);
context->thisObject().setProperty(scopeName, result);
- if (engine->m_observeMode == ObserveMode::Enabled)
- engine->m_requireResults.push_back(result);
+ engine->m_requireResults.push_back(result);
engine->m_filePathsPerImport[result.objectId()] = { filePath };
} catch (const ErrorInfo &e) {
result = context->throwError(e.toString());
diff --git a/src/lib/qtprofilesetup/templates/qmlcache.qbs b/src/lib/qtprofilesetup/templates/qmlcache.qbs
index 246486c53..9111eb500 100644
--- a/src/lib/qtprofilesetup/templates/qmlcache.qbs
+++ b/src/lib/qtprofilesetup/templates/qmlcache.qbs
@@ -1,14 +1,22 @@
+import qbs.File
import qbs.FileInfo
import qbs.Process
+import qbs.Utilities
Module {
additionalProductTypes: ["qt.qml.qmlc", "qt.qml.jsc"]
- validate: qmlcachegenProbe.found
+ validate: {
+ if (!qmlcachegenProbe.found)
+ throw "qmlcachegen unsupported for this target";
+ }
property string qmlCacheGenPath: FileInfo.joinPaths(Qt.core.binPath, "qmlcachegen")
+ (qbs.hostOS.contains("windows") ? ".exe" : "")
+ property bool supportsAllArchitectures: Utilities.versionCompare(Qt.core.version, "5.11") >= 0
property string installDir
readonly property stringList _targetArgs: {
+ if (supportsAllArchitectures)
+ return [];
function translateArch(arch) {
if (arch === "x86")
return "i386";
@@ -24,15 +32,25 @@ Module {
Depends { name: "Qt.core" }
Probe {
id: qmlcachegenProbe
+
+ property string arch: qbs.architecture
+ property string _qmlCacheGenPath: qmlCacheGenPath
+ property stringList targetArgs: _targetArgs
+ property bool _supportsAllArchitectures: supportsAllArchitectures
+
configure: {
+ if (_supportsAllArchitectures) {
+ found = File.exists(_qmlCacheGenPath);
+ return;
+ }
var process = new Process();
found = false;
try {
- found = process.exec(qmlCacheGenPath,
- _targetArgs.concat("--check-if-supported")) == 0;
+ found = process.exec(_qmlCacheGenPath,
+ targetArgs.concat("--check-if-supported")) == 0;
if (!found) {
var msg = "QML cache generation was requested but is unsupported on "
- + "architecture '" + qbs.architecture + "'.";
+ + "architecture '" + arch + "'.";
console.warn(msg);
}
} finally {
diff --git a/src/lib/scriptengine/include/QtScript/qtscriptglobal.h b/src/lib/scriptengine/include/QtScript/qtscriptglobal.h
new file mode 100644
index 000000000..8b1e09bb1
--- /dev/null
+++ b/src/lib/scriptengine/include/QtScript/qtscriptglobal.h
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qbs.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** 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-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QBS_QTSCRIPTGLOBAL_H
+#define QBS_QTSCRIPTGLOBAL_H
+
+#define Q_SCRIPT_EXPORT
+#define Q_SCRIPTTOOLS_EXPORT
+
+#endif // include guard
diff --git a/src/lib/scriptengine/scriptengine.pro b/src/lib/scriptengine/scriptengine.pro
index f5d4ad590..c5ad5f07a 100644
--- a/src/lib/scriptengine/scriptengine.pro
+++ b/src/lib/scriptengine/scriptengine.pro
@@ -61,6 +61,7 @@ DEFINES += JS_NO_EXPORT
}
INCLUDEPATH += \
+ $$PWD/include \
$$OUT_PWD/include \
$$OUT_PWD/include/QtScript/$$[QT_VERSION]/QtScript \
$$PWD/../../shared/qtscript/src/script \
diff --git a/src/lib/scriptengine/scriptengine.qbs b/src/lib/scriptengine/scriptengine.qbs
index c92bc1954..77e6ef7d2 100644
--- a/src/lib/scriptengine/scriptengine.qbs
+++ b/src/lib/scriptengine/scriptengine.qbs
@@ -17,12 +17,18 @@ Project {
type: ["staticlibrary"]
name: "qbsscriptengine"
+ generatePkgConfigFile: false
+ generateQbsModule: false
+
property bool useSystemMalloc: !qbs.targetOS.contains("macos")
&& !qbs.targetOS.contains("unix")
property string qtscriptPath: "../../shared/qtscript/src/"
cpp.includePaths: {
- var result = base.concat(["."]);
+ var result = base.concat(
+ ".",
+ "include"
+ );
var jscBaseDir = qtscriptPath + "3rdparty/javascriptcore";
result.push(jscBaseDir);
@@ -355,7 +361,8 @@ Project {
Export {
Depends { name: "QtScriptFwdHeaders" }
Depends { name: "cpp" }
- cpp.includePaths: QtScriptFwdHeaders.publicIncludePaths
+ property stringList includePaths: [product.sourceDirectory + "/include"]
+ .concat(QtScriptFwdHeaders.publicIncludePaths)
Properties {
condition: qbs.targetOS.contains("unix")
cpp.dynamicLibraries: base.concat(["pthread"])
diff --git a/src/lib/scriptengine/use_scriptengine.pri b/src/lib/scriptengine/use_scriptengine.pri
index 296b6e416..6450e171f 100644
--- a/src/lib/scriptengine/use_scriptengine.pri
+++ b/src/lib/scriptengine/use_scriptengine.pri
@@ -7,4 +7,5 @@
}
INCLUDEPATH += \
+ $$PWD/include \
$$shadowed($$PWD/include)