diff options
author | Ivan Komissarov <abbapoh@gmail.com> | 2021-08-03 10:59:10 +0300 |
---|---|---|
committer | Ivan Komissarov <abbapoh@gmail.com> | 2021-08-03 10:59:10 +0300 |
commit | 0dbd8bf8937297904ab8e9f99eeb91c6ff760b90 (patch) | |
tree | 60f826d271890e7ac6a0884baeac7564e6fd5348 | |
parent | ae1368529849bcad0d7d524ae9396c4205209322 (diff) | |
parent | e8b7cac678652bc2e1b9bcce5d808988a5b86982 (diff) |
Merge branch '1.20' into master
Change-Id: I3b1bbc2e952a20e2322cf49f291b4a77d9da2f57
52 files changed, 217 insertions, 229 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6d0bfad56..06524ccf8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -79,6 +79,16 @@ jobs: options: 'CONFIG+=ccache', cacheid: 'qmake', } + - { + name: 'Build on Linux (gcc, Qt 6)', + image: 'focal-qt6', + script: './scripts/build-qbs-with-qbs.sh', + options: 'modules.cpp.compilerWrapper:ccache + modules.qbsbuildconfig.enableAddressSanitizer:false + modules.qbs.debugInformation:true + modules.qbsbuildconfig.enableBundledQt:true', + cacheid: 'gcc-qt6', + } env: BUILD_OPTIONS: ${{ matrix.config.options }} QTEST_FUNCTION_TIMEOUT: 9000000 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2eb5fbe7f..41b1ae88d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,6 @@ jobs: options: 'qbs.installPrefix:"" modules.cpp.compilerWrapper:ccache modules.qbsbuildconfig.enableAddressSanitizer:false - modules.qbsbuildconfig.enableProjectFileUpdates:false modules.qbsbuildconfig.enableUnitTests:false modules.qbsbuildconfig.enableBundledQt:true', script: './scripts/build-qbs-with-qbs.sh', @@ -71,7 +70,6 @@ jobs: qbs.installPrefix:"" modules.cpp.compilerWrapper:ccache modules.qbsbuildconfig.enableUnitTests:false - modules.qbsbuildconfig.enableProjectFileUpdates:false modules.qbsbuildconfig.enableAddressSanitizer:false modules.qbsbuildconfig.enableBundledQt:true WITH_TESTS: 0 @@ -156,7 +154,6 @@ jobs: qbs.buildVariant:release modules.cpp.compilerWrapper:clcache modules.qbsbuildconfig.enableBundledQt:true - modules.qbsbuildconfig.enableProjectFileUpdates:false modules.qbsbuildconfig.enableUnitTests:false modules.cpp.treatWarningsAsErrors:true project.withDocumentation:true diff --git a/CMakeLists.txt b/CMakeLists.txt index b167aab4a..cdd009e7e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,8 +47,8 @@ else() if(NOT TARGET Qt6Core5Compat) add_library(Qt6Core5Compat INTERFACE) endif() - if(Qt5Script_FOUND) - set_property(TARGET Qt5::Script PROPERTY IMPORTED_GLOBAL TRUE) + if (NOT QBS_USE_BUNDLED_QT_SCRIPT AND Qt5Script_FOUND) + add_library(qbsscriptengine ALIAS Qt5::Script) endif() endif() diff --git a/changelogs/changes-1.19.1.md b/changelogs/changes-1.19.1.md new file mode 100644 index 000000000..c4cab506f --- /dev/null +++ b/changelogs/changes-1.19.1.md @@ -0,0 +1,12 @@ +# C/C++ Support + +* Fix system include support with MSVC >= 19.29.30037 + +# Qt Support + +* Fix possible command line length issue with qmlimportscanner when cross-compiling (QBS-1633). + +# Apple platforms + +* Fix stripping debug symbols in multiplexed products when cpp.separateDebugInformation + is false (QBS-1647) diff --git a/changelogs/changes-1.19.2.md b/changelogs/changes-1.19.2.md new file mode 100644 index 000000000..8f76b5a38 --- /dev/null +++ b/changelogs/changes-1.19.2.md @@ -0,0 +1,5 @@ +# Important Bug Fixes + +* codesign: Fix checking if product is a framework (QBS-1649) +* codesign: Add additional signing flags at end of command (QBS-1651) +* codesign: Add new codesign.timestampAlgorithm property (QBS-1651) diff --git a/cmake/QbsBuildConfig.cmake b/cmake/QbsBuildConfig.cmake index 8bdfec77e..f0861010a 100644 --- a/cmake/QbsBuildConfig.cmake +++ b/cmake/QbsBuildConfig.cmake @@ -1,6 +1,5 @@ option(WITH_TESTS "Build Tests" ON) option(WITH_UNIT_TESTS "Build Unit Tests" OFF) -option(WITH_PROJECT_FILE_UPDATES "Enable project file updates support" ON) option(INSTALL_PUBLIC_HEADERS "Whether to install public headers" ON) option(QBS_ENABLE_RPATH "Whether to enable RPATH" ON) option(QBS_USE_BUNDLED_QT_SCRIPT "Whether to use bundled QtScript module" OFF) @@ -74,12 +73,6 @@ else() set(QBS_UNIT_TESTS_DEFINES "") endif() -if(WITH_PROJECT_FILE_UPDATES) - set(QBS_PROJECT_FILE_UPDATES_DEFINES "QBS_ENABLE_PROJECT_FILE_UPDATES") -else() - set(QBS_PROJECT_FILE_UPDATES_DEFINES "") -endif() - file(RELATIVE_PATH QBS_RELATIVE_LIBEXEC_PATH "/${QBS_APP_INSTALL_DIR}" "/${QBS_LIBEXEC_INSTALL_DIR}") file(RELATIVE_PATH QBS_RELATIVE_SEARCH_PATH "/${QBS_APP_INSTALL_DIR}" "/${QBS_RESOURCES_INSTALL_BASE}") file(RELATIVE_PATH QBS_RELATIVE_PLUGINS_PATH "/${QBS_APP_INSTALL_DIR}" "/${QBS_PLUGINS_INSTALL_BASE}") diff --git a/doc/qbs.qdoc b/doc/qbs.qdoc index 656a1245d..2e14e8572 100644 --- a/doc/qbs.qdoc +++ b/doc/qbs.qdoc @@ -513,8 +513,6 @@ \header \li Option \li Notes \li Default value \row \li WITH_TESTS \li Enable autotests. \li \c ON \row \li WITH_UNIT_TESTS \li Enable additional autotests. \li \c OFF - \row \li WITH_PROJECT_FILE_UPDATES \li Enable API for updating project files. This - implies a dependency to the QtGui module. \li \c OFF \row \li INSTALL_PUBLIC_HEADERS \li Whether to install public headers. \li \c ON \endtable @@ -558,8 +556,6 @@ \row \li qbs_no_dev_install \li Exclude header files from installation, that is, perform a non-developer build. \row \li qbs_no_man_install \li Exclude the man page from installation. - \row \li qbs_enable_project_file_updates \li Enable API for updating project files. This - implies a dependency to the Qt GUI module. \row \li qbs_use_bundled_qtscript \li Use the bundled QtScript library. \endtable @@ -632,11 +628,6 @@ \li Enable additional autotests. Enabling this option will export some symbols that would otherwise be private. \row - \li enableProjectFileUpdates - \li \c false - \li Enable API for updating project files. This is required for an IDE and implies a - dependency to the Qt GUI module that would not be needed for the \QBS command-line tool. - \row \li enableRPath \li \c true \li Use this property to disable the use of rpath. This can be used when packaging \QBS diff --git a/doc/reference/modules/codesign-module.qdoc b/doc/reference/modules/codesign-module.qdoc index d0aba4688..45e247a6a 100644 --- a/doc/reference/modules/codesign-module.qdoc +++ b/doc/reference/modules/codesign-module.qdoc @@ -343,6 +343,22 @@ */ /*! + \qmlproperty string codesign::timestampAlgorithm + + Specifies the default timestamp algorithm used together with the + \c signingTimestamp property. The possible values are \c sha1, \c sha256. + + \note If this value is not set, then the default sha1 algorithm + will be used. + + \since Qbs 1.19.2 + + \defaultvalue \c undefined + + \windowsproperty +*/ + +/*! \qmlproperty string codesign::certificatePath Specifies the full path to the signing certificate file (*.pfx). diff --git a/doc/reference/modules/qbs-module.qdoc b/doc/reference/modules/qbs-module.qdoc index c02de65ab..82a9120cc 100644 --- a/doc/reference/modules/qbs-module.qdoc +++ b/doc/reference/modules/qbs-module.qdoc @@ -526,6 +526,9 @@ \li \c{"msvc"} \li \c{["msvc"]} \row + \li \c{"qcc"} + \li \c{["qcc"]} + \row \li \c{"sdcc"} \li \c{["sdcc"]} \row diff --git a/docker-compose.yml b/docker-compose.yml index 13b4f6a2f..86b52b145 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,13 +32,13 @@ services: focal-qt6: << : *linux hostname: focal-qt6 - image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-qt6-6.0.2_1.18.2-0 + image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-qt6-6.1.2_1.19.2-0 build: dockerfile: docker/focal/Dockerfile context: . args: - QT_VERSION: 6.0.2 - QTCREATOR_VERSION: 4.14.2 + QT_VERSION: 6.1.2 + QTCREATOR_VERSION: 4.15.2 focal-android-513: << : *linux diff --git a/scripts/build-qbs-with-cmake.sh b/scripts/build-qbs-with-cmake.sh index c4c954fd6..820f30303 100755 --- a/scripts/build-qbs-with-cmake.sh +++ b/scripts/build-qbs-with-cmake.sh @@ -47,7 +47,6 @@ export QBS_AUTOTEST_SETTINGS_DIR="${QBS_AUTOTEST_SETTINGS_DIR:-/tmp/qbs-settings BUILD_OPTIONS="\ -DWITH_UNIT_TESTS=1 \ - -DWITH_PROJECT_FILE_UPDATES=1 \ -DQBS_INSTALL_HTML_DOCS=1 \ -DQBS_INSTALL_QCH_DOCS=1 \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ diff --git a/scripts/build-qbs-with-qbs.sh b/scripts/build-qbs-with-qbs.sh index 32241a3a2..42d02c3cc 100755 --- a/scripts/build-qbs-with-qbs.sh +++ b/scripts/build-qbs-with-qbs.sh @@ -59,7 +59,6 @@ fi BUILD_OPTIONS="\ profile:${QBS_BUILD_PROFILE} \ modules.qbsbuildconfig.enableAddressSanitizer:true \ - modules.qbsbuildconfig.enableProjectFileUpdates:true \ modules.qbsbuildconfig.enableUnitTests:true \ modules.cpp.treatWarningsAsErrors:true \ modules.cpp.separateDebugInformation:true \ diff --git a/scripts/build-qbs-with-qmake.sh b/scripts/build-qbs-with-qmake.sh index 1e97d7695..69ea75a21 100755 --- a/scripts/build-qbs-with-qmake.sh +++ b/scripts/build-qbs-with-qmake.sh @@ -50,7 +50,6 @@ export QBS_AUTOTEST_SETTINGS_DIR="${QBS_AUTOTEST_SETTINGS_DIR:-/tmp/qbs-settings # qmake -r qbs.pro \ CONFIG+=qbs_enable_unit_tests \ - CONFIG+=qbs_enable_project_file_updates \ ${BUILD_OPTIONS} make -j $(nproc --all) make docs diff --git a/scripts/run-analyzer.sh b/scripts/run-analyzer.sh index 49f21c402..4293883a1 100755 --- a/scripts/run-analyzer.sh +++ b/scripts/run-analyzer.sh @@ -61,7 +61,6 @@ CPU_COUNT=$("$(dirname "$0")"/cpu-count.sh) BUILD_OPTIONS="\ ${QBS_BUILD_PROFILE:+profile:${QBS_BUILD_PROFILE}} \ - modules.qbsbuildconfig.enableProjectFileUpdates:true \ modules.cpp.treatWarningsAsErrors:true \ modules.qbs.buildVariant:release \ project.withTests:false \ diff --git a/share/qbs/modules/codesign/codesign.js b/share/qbs/modules/codesign/codesign.js index 5aa303c9c..463e7cbb7 100644 --- a/share/qbs/modules/codesign/codesign.js +++ b/share/qbs/modules/codesign/codesign.js @@ -301,16 +301,14 @@ function prepareSign(project, product, inputs, outputs, input, output) { // If this is a framework, we need to sign its versioned directory var subpath = ""; if (isBundle) { - var frameworkVersion = product.bundle.frameworkVersion; - if (frameworkVersion) { + var isFramework = product.bundle.packageType === "FMWK"; + if (isFramework) { subpath = product.bundle.contentsFolderPath; subpath = subpath.substring(product.bundle.bundleName.length); } } - var args = product.codesign.codesignFlags || []; - args.push("--force"); - args.push("--sign", actualSigningIdentity.SHA1); + var args = ["--force", "--sign", actualSigningIdentity.SHA1]; // If signingTimestamp is undefined or empty, do not specify the flag at all - // this uses the system-specific default behavior @@ -328,6 +326,9 @@ function prepareSign(project, product, inputs, outputs, input, output) { args.push("--entitlements", inputs["codesign.xcent"][j].filePath); break; // there should only be one } + + args = args.concat(product.codesign.codesignFlags || []); + args.push(outputFilePath + subpath); cmd = new Command(product.codesign.codesignPath, args); cmd.description = "codesign " + outputFileName @@ -425,7 +426,7 @@ function prepareSigntool(project, product, inputs, outputs, input, output) { if (!product.codesign.enableCodeSigning) return cmds; - var args = ["sign"].concat(product.codesign.codesignFlags || []); + var args = ["sign"]; var subjectName = product.codesign.subjectName; if (subjectName) @@ -443,6 +444,10 @@ function prepareSigntool(project, product, inputs, outputs, input, output) { if (signingTimestamp) args.push("/tr", signingTimestamp); + var timestampAlgorithm = product.codesign.timestampAlgorithm; + if (timestampAlgorithm) + args.push("/td", timestampAlgorithm); + var certificatePath = product.codesign.certificatePath; if (certificatePath) args.push("/f", certificatePath); @@ -455,6 +460,8 @@ function prepareSigntool(project, product, inputs, outputs, input, output) { if (crossCertificatePath) args.push("/ac", crossCertificatePath); + args = args.concat(product.codesign.codesignFlags || []); + var outputArtifact = outputs["codesign.signed_artifact"][0]; args.push(outputArtifact.filePath); diff --git a/share/qbs/modules/codesign/signtool.qbs b/share/qbs/modules/codesign/signtool.qbs index 02a2c978e..d0dda3a31 100644 --- a/share/qbs/modules/codesign/signtool.qbs +++ b/share/qbs/modules/codesign/signtool.qbs @@ -70,6 +70,13 @@ CodeSignModule { allowedValues: ["sha1", "sha256", "sha384", "sha512"] } + property string timestampAlgorithm + PropertyOptions { + name: "timestampAlgorithm" + description: "Name of the timestamp algorithm." + allowedValues: ["sha1", "sha256"] + } + property path certificatePath PropertyOptions { name: "certificatePath" diff --git a/share/qbs/modules/cpp/android-gcc.qbs b/share/qbs/modules/cpp/android-gcc.qbs index e42601a23..17e1f72ed 100644 --- a/share/qbs/modules/cpp/android-gcc.qbs +++ b/share/qbs/modules/cpp/android-gcc.qbs @@ -123,6 +123,7 @@ LinuxGCC { dynamicLibrarySuffix))); return libs; } + staticLibraries: staticStlFilePath defines: ["ANDROID", "__ANDROID__"] diff --git a/share/qbs/modules/cpp/keil.js b/share/qbs/modules/cpp/keil.js index 86fbb153c..5a5e165c8 100644 --- a/share/qbs/modules/cpp/keil.js +++ b/share/qbs/modules/cpp/keil.js @@ -476,7 +476,7 @@ function compilerFlags(project, product, input, outputs, explicitlyDependsOn) { args.push(input.filePath); // Output. - args.push("OBJECT (" + outputs.obj[0].filePath + ")"); + args.push("OBJECT(" + FileInfo.toWindowsSeparators(outputs.obj[0].filePath) + ")"); // Defines. var defines = Cpp.collectDefines(input); @@ -487,7 +487,8 @@ function compilerFlags(project, product, input, outputs, explicitlyDependsOn) { var allIncludePaths = [].concat(Cpp.collectIncludePaths(input), Cpp.collectSystemIncludePaths(input)); if (allIncludePaths.length > 0) - args = args.concat("INCDIR (" + allIncludePaths.join(";") + ")"); + args = args.concat("INCDIR(" + allIncludePaths.map(function(path) { + return FileInfo.toWindowsSeparators(path); }).join(";") + ")"); // Debug information flags. if (input.cpp.debugInformation) @@ -522,7 +523,7 @@ function compilerFlags(project, product, input, outputs, explicitlyDependsOn) { if (!input.cpp.generateCompilerListingFiles) args.push("NOPRINT"); else - args.push("PRINT(" + outputs.lst[0].filePath + ")"); + args.push("PRINT(" + FileInfo.toWindowsSeparators(outputs.lst[0].filePath) + ")"); } else if (isArmArchitecture(architecture)) { // Input. args.push("-c", input.filePath); @@ -690,13 +691,14 @@ function assemblerFlags(project, product, input, outputs, explicitlyDependsOn) { args.push(input.filePath); // Output. - args.push("OBJECT (" + outputs.obj[0].filePath + ")"); + args.push("OBJECT(" + FileInfo.toWindowsSeparators(outputs.obj[0].filePath) + ")"); // Includes. var allIncludePaths = [].concat(Cpp.collectIncludePaths(input), Cpp.collectSystemIncludePaths(input)); if (allIncludePaths.length > 0) - args = args.concat("INCDIR (" + allIncludePaths.join(";") + ")"); + args = args.concat("INCDIR(" + allIncludePaths.map(function(path) { + return FileInfo.toWindowsSeparators(path); }).join(";") + ")"); // Debug information flags. if (input.cpp.debugInformation) @@ -709,7 +711,7 @@ function assemblerFlags(project, product, input, outputs, explicitlyDependsOn) { if (!input.cpp.generateAssemblerListingFiles) args.push("NOPRINT"); else - args.push("PRINT(" + outputs.lst[0].filePath + ")"); + args.push("PRINT(" + FileInfo.toWindowsSeparators(outputs.lst[0].filePath) + ")"); } else if (isArmArchitecture(architecture)) { // Input. args.push(input.filePath); @@ -790,16 +792,17 @@ function linkerFlags(project, product, inputs, outputs) { // Add all input objects as arguments (application and library object files). var allObjectPaths = collectAllObjectPathsArguments(product, inputs); if (allObjectPaths.length > 0) - args = args.concat(allObjectPaths.join(",")); + args = args.concat(allObjectPaths.map(function(path) { + return FileInfo.toWindowsSeparators(path); }).join(",")); // Output. - args.push("TO", outputs.application[0].filePath); + args.push("TO", FileInfo.toWindowsSeparators(outputs.application[0].filePath)); // Map file generation flag. if (!product.cpp.generateLinkerMapFile) args.push("NOPRINT"); else - args.push("PRINT(" + outputs.mem_map[0].filePath + ")"); + args.push("PRINT(" + FileInfo.toWindowsSeparators(outputs.mem_map[0].filePath) + ")"); } else if (isArmArchitecture(architecture)) { // Inputs. args = args.concat(Cpp.collectLinkerObjectPaths(inputs)); @@ -851,10 +854,11 @@ function archiverFlags(project, product, inputs, outputs) { // Inputs. if (objectPaths.length > 0) - args = args.concat(objectPaths.join(",")); + args = args.concat(objectPaths.map(function(path) { + return FileInfo.toWindowsSeparators(path); }).join(",")); // Output. - args.push("TO", outputs.staticlibrary[0].filePath); + args.push("TO", FileInfo.toWindowsSeparators(outputs.staticlibrary[0].filePath)); } else if (isArmArchitecture(architecture)) { // Note: The ARM archiver command line expect the output file // first, and then a set of input objects. diff --git a/share/qbs/modules/cpp/msvc.js b/share/qbs/modules/cpp/msvc.js index b27bb23c9..1ebe5173b 100644 --- a/share/qbs/modules/cpp/msvc.js +++ b/share/qbs/modules/cpp/msvc.js @@ -579,9 +579,9 @@ function prepareLinker(project, product, inputs, outputs, input, output) { var wrapperArgs = product.cpp.linkerWrapper; if (wrapperArgs && wrapperArgs.length > 0) { - linkerArgs.unshift(linkerPath); + args.unshift(linkerPath); linkerPath = wrapperArgs.shift(); - linkerArgs = wrapperArgs.concat(linkerArgs); + args = wrapperArgs.concat(args); } var commands = []; var warningCmd = new JavaScriptCommand(); diff --git a/src/app/qbs/session.cpp b/src/app/qbs/session.cpp index 9272ce231..5a1fe145d 100644 --- a/src/app/qbs/session.cpp +++ b/src/app/qbs/session.cpp @@ -399,7 +399,6 @@ void Session::addFiles(const QJsonObject &request) } ErrorInfo error; QStringList failedFiles; -#ifdef QBS_ENABLE_PROJECT_FILE_UPDATES for (const QString &filePath : data.filePaths) { const ErrorInfo e = m_project.addFiles(data.product, data.group, {filePath}); if (e.hasError()) { @@ -408,7 +407,6 @@ void Session::addFiles(const QJsonObject &request) failedFiles.push_back(filePath); } } -#endif QJsonObject reply; reply.insert(StringConstants::type(), QLatin1String("files-added")); insertErrorInfoIfNecessary(reply, error); @@ -435,7 +433,6 @@ void Session::removeFiles(const QJsonObject &request) } ErrorInfo error; QStringList failedFiles; -#ifdef QBS_ENABLE_PROJECT_FILE_UPDATES for (const QString &filePath : data.filePaths) { const ErrorInfo e = m_project.removeFiles(data.product, data.group, {filePath}); if (e.hasError()) { @@ -444,7 +441,6 @@ void Session::removeFiles(const QJsonObject &request) failedFiles.push_back(filePath); } } -#endif QJsonObject reply; reply.insert(StringConstants::type(), QLatin1String("files-removed")); insertErrorInfoIfNecessary(reply, error); @@ -656,9 +652,6 @@ Session::FileUpdateData Session::prepareFileUpdate(const QJsonObject &request) data.error = tr("Cannot update the list of source files while a job is running."); if (!m_project.isValid()) data.error = tr("No valid project. You need to resolve first."); -#ifndef QBS_ENABLE_PROJECT_FILE_UPDATES - data.error = ErrorInfo(tr("Project file updates are not enabled in this build of qbs.")); -#endif return data; } diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 8356cd6a1..a463d6464 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -1,7 +1,5 @@ if (QBS_USE_BUNDLED_QT_SCRIPT OR NOT Qt5Script_FOUND) add_subdirectory(scriptengine) -else() - add_library(qbsscriptengine ALIAS Qt5::Script) endif() add_subdirectory(corelib) diff --git a/src/lib/corelib/CMakeLists.txt b/src/lib/corelib/CMakeLists.txt index 06e725ab4..2a38a4943 100644 --- a/src/lib/corelib/CMakeLists.txt +++ b/src/lib/corelib/CMakeLists.txt @@ -421,8 +421,6 @@ add_qbs_library(qbscore "QBS_RELATIVE_LIBEXEC_PATH=\"${QBS_RELATIVE_LIBEXEC_PATH}\"" "QBS_LIBRARY" ${QBS_UNIT_TESTS_DEFINES} - PUBLIC_DEFINES - ${QBS_PROJECT_FILE_UPDATES_DEFINES} DEPENDS Qt${QT_VERSION_MAJOR}::CorePrivate Qt${QT_VERSION_MAJOR}::Network diff --git a/src/lib/corelib/api/api.pri b/src/lib/corelib/api/api.pri index ddb1171d4..69443dffc 100644 --- a/src/lib/corelib/api/api.pri +++ b/src/lib/corelib/api/api.pri @@ -38,15 +38,12 @@ SOURCES += \ INSTALLS += api_headers } -qbs_enable_project_file_updates { - HEADERS += \ - $$PWD/changeset.h \ - $$PWD/projectfileupdater.h \ - $$PWD/qmljsrewriter.h +HEADERS += \ + $$PWD/changeset.h \ + $$PWD/projectfileupdater.h \ + $$PWD/qmljsrewriter.h - SOURCES += \ - $$PWD/changeset.cpp \ - $$PWD/projectfileupdater.cpp \ - $$PWD/qmljsrewriter.cpp - DEFINES += QBS_ENABLE_PROJECT_FILE_UPDATES -} +SOURCES += \ + $$PWD/changeset.cpp \ + $$PWD/projectfileupdater.cpp \ + $$PWD/qmljsrewriter.cpp diff --git a/src/lib/corelib/api/project.cpp b/src/lib/corelib/api/project.cpp index 65b9b4efa..23513564b 100644 --- a/src/lib/corelib/api/project.cpp +++ b/src/lib/corelib/api/project.cpp @@ -39,13 +39,10 @@ #include "project.h" #include "project_p.h" -#ifdef QBS_ENABLE_PROJECT_FILE_UPDATES -#include "projectfileupdater.h" -#endif - #include "internaljobs.h" #include "jobs.h" #include "projectdata_p.h" +#include "projectfileupdater.h" #include "propertymap_p.h" #include "rulecommand_p.h" #include "runenvironment.h" @@ -343,7 +340,6 @@ void ProjectPrivate::setupInstallData(ArtifactData &artifact, } } -#ifdef QBS_ENABLE_PROJECT_FILE_UPDATES void ProjectPrivate::addGroup(const ProductData &product, const QString &groupName) { if (groupName.isEmpty()) @@ -520,7 +516,6 @@ void ProjectPrivate::removeGroup(const ProductData &product, const GroupData &gr remover.apply(); } -#endif // QBS_ENABLE_PROJECT_FILE_UPDATES void ProjectPrivate::prepareChangeToProject() { @@ -1057,7 +1052,6 @@ Project::BuildGraphInfo Project::getBuildGraphInfo() const return info; } -#ifdef QBS_ENABLE_PROJECT_FILE_UPDATES /*! * \brief Adds a new empty group to the given product. * Returns an \c ErrorInfo object for which \c hasError() is false in case of a success @@ -1155,6 +1149,5 @@ ErrorInfo Project::removeGroup(const ProductData &product, const GroupData &grou return errorInfo; } } -#endif // QBS_ENABLE_PROJECT_FILE_UPDATES } // namespace qbs diff --git a/src/lib/corelib/api/project.h b/src/lib/corelib/api/project.h index 9000d6548..380806f3a 100644 --- a/src/lib/corelib/api/project.h +++ b/src/lib/corelib/api/project.h @@ -159,14 +159,12 @@ public: BuildGraphInfo getBuildGraphInfo() const; -#ifdef QBS_ENABLE_PROJECT_FILE_UPDATES ErrorInfo addGroup(const ProductData &product, const QString &groupName); ErrorInfo addFiles(const ProductData &product, const GroupData &group, const QStringList &filePaths); ErrorInfo removeFiles(const ProductData &product, const GroupData &group, const QStringList &filePaths); ErrorInfo removeGroup(const ProductData &product, const GroupData &group); -#endif // QBS_ENABLE_PROJECT_FILE_UPDATES private: Project(const Internal::TopLevelProjectPtr &internalProject, const Internal::Logger &logger); diff --git a/src/lib/corelib/buildgraph/buildgraphloader.cpp b/src/lib/corelib/buildgraph/buildgraphloader.cpp index c5a377550..f1a5e5cb9 100644 --- a/src/lib/corelib/buildgraph/buildgraphloader.cpp +++ b/src/lib/corelib/buildgraph/buildgraphloader.cpp @@ -643,8 +643,8 @@ bool BuildGraphLoader::hasBuildSystemFileChanged(const Set<QString> &buildSystem const auto generatedChecker = [&file, restoredProject](const ModuleProviderInfo &mpi) { return file.startsWith(mpi.outputDirPath(restoredProject->buildDirectory)); }; - const bool fileWasCreatedByModuleProvider = any_of(restoredProject->moduleProviderInfo, - generatedChecker); + const bool fileWasCreatedByModuleProvider = + any_of(restoredProject->moduleProviderInfo.providers, generatedChecker); const FileTime referenceTime = fileWasCreatedByModuleProvider ? restoredProject->lastEndResolveTime : restoredProject->lastStartResolveTime; if (referenceTime < fi.lastModified()) { diff --git a/src/lib/corelib/corelib.qbs b/src/lib/corelib/corelib.qbs index 65644ea32..cece18126 100644 --- a/src/lib/corelib/corelib.qbs +++ b/src/lib/corelib/corelib.qbs @@ -24,8 +24,6 @@ QbsLibrary { ".", "../.." // for the plugin headers ]) - property stringList projectFileUpdateDefines: - qbsbuildconfig.enableProjectFileUpdates ? ["QBS_ENABLE_PROJECT_FILE_UPDATES"] : [] property stringList enableUnitTestsDefines: qbsbuildconfig.enableUnitTests ? ["QBS_ENABLE_UNIT_TESTS"] : [] property stringList systemSettingsDirDefines: qbsbuildconfig.systemSettingsDir @@ -33,8 +31,7 @@ QbsLibrary { cpp.defines: base.concat([ "QBS_RELATIVE_LIBEXEC_PATH=" + Utilities.cStringQuote(qbsbuildconfig.relativeLibexecPath), "QBS_VERSION=" + Utilities.cStringQuote(version), - ]).concat(projectFileUpdateDefines).concat(enableUnitTestsDefines) - .concat(systemSettingsDirDefines) + ]).concat(enableUnitTestsDefines).concat(systemSettingsDirDefines) Properties { condition: qbs.targetOS.contains("windows") @@ -55,7 +52,6 @@ QbsLibrary { } Group { name: "project file updating" - condition: qbsbuildconfig.enableProjectFileUpdates prefix: "api/" files: [ "changeset.cpp", @@ -530,8 +526,4 @@ QbsLibrary { qbs.install: qbsbuildconfig.installApiHeaders qbs.installDir: headerInstallPrefix } - Export { - Depends { name: "cpp" } - cpp.defines: base.concat(exportingProduct.projectFileUpdateDefines) - } } diff --git a/src/lib/corelib/language/language.cpp b/src/lib/corelib/language/language.cpp index 0b472a668..8c8b4a9a2 100644 --- a/src/lib/corelib/language/language.cpp +++ b/src/lib/corelib/language/language.cpp @@ -614,7 +614,7 @@ QString TopLevelProject::profile() const void TopLevelProject::makeModuleProvidersNonTransient() { - for (ModuleProviderInfo &m : moduleProviderInfo) + for (ModuleProviderInfo &m : moduleProviderInfo.providers) m.transientOutput = false; } @@ -664,7 +664,7 @@ void TopLevelProject::store(PersistentPool &pool) void TopLevelProject::cleanupModuleProviderOutput() { QString error; - for (const ModuleProviderInfo &m : moduleProviderInfo) { + for (const ModuleProviderInfo &m : moduleProviderInfo.providers) { if (m.transientOutput) { if (!removeDirectoryWithContents(m.outputDirPath(buildDirectory), &error)) qCWarning(lcBuildGraph) << "Error removing module provider output:" << error; diff --git a/src/lib/corelib/language/language.h b/src/lib/corelib/language/language.h index 23a5f1d1a..e50691560 100644 --- a/src/lib/corelib/language/language.h +++ b/src/lib/corelib/language/language.h @@ -688,7 +688,7 @@ public: QString buildDirectory; // Not saved QProcessEnvironment environment; std::vector<ProbeConstPtr> probes; - ModuleProviderInfoList moduleProviderInfo; + StoredModuleProviderInfo moduleProviderInfo; QHash<QString, QString> canonicalFilePathResults; // Results of calls to "File.canonicalFilePath()." QHash<QString, bool> fileExistsResults; // Results of calls to "File.exists()". diff --git a/src/lib/corelib/language/loader.cpp b/src/lib/corelib/language/loader.cpp index f248fbb1a..1de84da63 100644 --- a/src/lib/corelib/language/loader.cpp +++ b/src/lib/corelib/language/loader.cpp @@ -104,7 +104,7 @@ void Loader::setStoredProfiles(const QVariantMap &profiles) m_storedProfiles = profiles; } -void Loader::setStoredModuleProviderInfo(const ModuleProviderInfoList &providerInfo) +void Loader::setStoredModuleProviderInfo(const StoredModuleProviderInfo &providerInfo) { m_storedModuleProviderInfo = providerInfo; } diff --git a/src/lib/corelib/language/loader.h b/src/lib/corelib/language/loader.h index d172a74ed..2c8b08446 100644 --- a/src/lib/corelib/language/loader.h +++ b/src/lib/corelib/language/loader.h @@ -65,7 +65,7 @@ public: void setOldProductProbes(const QHash<QString, std::vector<ProbeConstPtr>> &oldProbes); void setLastResolveTime(const FileTime &time) { m_lastResolveTime = time; } void setStoredProfiles(const QVariantMap &profiles); - void setStoredModuleProviderInfo(const ModuleProviderInfoList &providerInfo); + void setStoredModuleProviderInfo(const StoredModuleProviderInfo &providerInfo); TopLevelProjectPtr loadProject(const SetupProjectParameters ¶meters); static void setupProjectFilePath(SetupProjectParameters ¶meters); @@ -77,7 +77,7 @@ private: QStringList m_searchPaths; std::vector<ProbeConstPtr> m_oldProjectProbes; QHash<QString, std::vector<ProbeConstPtr>> m_oldProductProbes; - ModuleProviderInfoList m_storedModuleProviderInfo; + StoredModuleProviderInfo m_storedModuleProviderInfo; QVariantMap m_storedProfiles; FileTime m_lastResolveTime; }; diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp index 3d059b4a8..6e1d74a03 100644 --- a/src/lib/corelib/language/moduleloader.cpp +++ b/src/lib/corelib/language/moduleloader.cpp @@ -238,6 +238,10 @@ public: } ~SearchPathsManager() { + reset(); + } + void reset() + { while (m_itemReader->extraSearchPathsStack().size() > m_oldSize) m_itemReader->popExtraSearchPaths(); } @@ -287,9 +291,9 @@ void ModuleLoader::setStoredProfiles(const QVariantMap &profiles) m_storedProfiles = profiles; } -void ModuleLoader::setStoredModuleProviderInfo(const ModuleProviderInfoList &moduleProviderInfo) +void ModuleLoader::setStoredModuleProviderInfo(const StoredModuleProviderInfo &moduleProviderInfo) { - m_moduleProviderLoader->setModuleProviderInfo(moduleProviderInfo); + m_moduleProviderLoader->setStoredModuleProviderInfo(moduleProviderInfo); } ModuleLoaderResult ModuleLoader::load(const SetupProjectParameters ¶meters) @@ -643,7 +647,7 @@ void ModuleLoader::handleTopLevelProject(ModuleLoaderResult *loadResult, Item *p } loadResult->projectProbes = tlp.probes; - loadResult->moduleProviderInfo = m_moduleProviderLoader->moduleProviderInfo(); + loadResult->storedModuleProviderInfo = m_moduleProviderLoader->storedModuleProviderInfo(); m_reader->clearExtraSearchPathsStack(); AccumulatingTimer timer(m_parameters.logElapsedTime() @@ -2238,8 +2242,6 @@ void ModuleLoader::setSearchPathsForProduct(ModuleLoader::ProductContext *produc if (!currentSearchPaths.contains(p) && FileInfo(p).exists()) product->searchPaths << p; } - - m_moduleProviderLoader->setupKnownModuleProviders(*product); } ModuleLoader::ShadowProductInfo ModuleLoader::getShadowProductInfo( @@ -3034,6 +3036,7 @@ Item *ModuleLoader::loadModule(ProductContext *productContext, Item *exportingPr } } + SearchPathsManager searchPathsManager(m_reader.get()); // paths can be added by providers Item *modulePrototype = nullptr; ProductModuleInfo * const pmi = productModule(productContext, fullName, multiplexId, *isProductDependency); @@ -3050,6 +3053,8 @@ Item *ModuleLoader::loadModule(ProductContext *productContext, Item *exportingPr if (!modulePrototype) return nullptr; + searchPathsManager.reset(); // deps must be processed in a clean state + instantiateModule(productContext, exportingProductItem, item, moduleInstance, modulePrototype, moduleName, pmi); return moduleInstance; @@ -3937,9 +3942,11 @@ void ModuleLoader::addTransitiveDependencies(ProductContext *ctx) if (module.isProduct) { ctx->item->addModule(module); } else { + const FallbackMode fallbackMode = m_parameters.fallbackProviderEnabled() + ? FallbackMode::Enabled : FallbackMode::Disabled; Item::Module dep; dep.item = loadModule(ctx, nullptr, ctx->item, ctx->item->location(), QString(), - module.name, QString(), FallbackMode::Disabled, + module.name, QString(), fallbackMode, module.required, &dep.isProduct, &dep.parameters); if (!dep.item) { throw ErrorInfo(Tr::tr("Module '%1' not found when setting up transitive " diff --git a/src/lib/corelib/language/moduleloader.h b/src/lib/corelib/language/moduleloader.h index 1e39c2cf5..cea3be518 100644 --- a/src/lib/corelib/language/moduleloader.h +++ b/src/lib/corelib/language/moduleloader.h @@ -76,6 +76,7 @@ class ItemReader; class ModuleProviderLoader; class ProgressObserver; class QualifiedId; +class SearchPathsManager; using ModulePropertiesPerGroup = std::unordered_map<const Item *, QualifiedIdSet>; @@ -109,7 +110,7 @@ struct ModuleLoaderResult Item *root; std::unordered_map<Item *, ProductInfo> productInfos; std::vector<ProbeConstPtr> projectProbes; - ModuleProviderInfoList moduleProviderInfo; + StoredModuleProviderInfo storedModuleProviderInfo; Set<QString> qbsFiles; QVariantMap profileConfigs; }; @@ -132,7 +133,7 @@ public: void setOldProductProbes(const QHash<QString, std::vector<ProbeConstPtr>> &oldProbes); void setLastResolveTime(const FileTime &time) { m_lastResolveTime = time; } void setStoredProfiles(const QVariantMap &profiles); - void setStoredModuleProviderInfo(const ModuleProviderInfoList &moduleProviderInfo); + void setStoredModuleProviderInfo(const StoredModuleProviderInfo &moduleProviderInfo); Evaluator *evaluator() const { return m_evaluator; } ModuleLoaderResult load(const SetupProjectParameters ¶meters); @@ -187,7 +188,6 @@ private: std::unordered_map<const Item *, std::vector<ErrorInfo>> unknownProfilePropertyErrors; QStringList searchPaths; - Set<QualifiedId> knownModuleProviders; std::optional<QVariantMap> theModuleProviderConfig; // The key corresponds to DeferredDependsContext.exportingProductItem, which is the diff --git a/src/lib/corelib/language/moduleproviderinfo.h b/src/lib/corelib/language/moduleproviderinfo.h index 4f757d3d9..8ed6f008d 100644 --- a/src/lib/corelib/language/moduleproviderinfo.h +++ b/src/lib/corelib/language/moduleproviderinfo.h @@ -76,17 +76,33 @@ public: template<PersistentPool::OpType opType> void completeSerializationOp(PersistentPool &pool) { - pool.serializationOp<opType>(reinterpret_cast<QStringList &>(name), config, searchPaths); + pool.serializationOp<opType>( + reinterpret_cast<QStringList &>(name), config, providerFile, searchPaths); } QualifiedId name; QVariantMap config; + QString providerFile; QStringList searchPaths; bool transientOutput = false; // Not to be serialized. }; using ModuleProviderInfoList = std::vector<ModuleProviderInfo>; +// Persistent info stored between sessions +struct StoredModuleProviderInfo +{ + using CacheKey = std::tuple<QString /*name*/, QVariantMap /*config*/, int /*lookup*/>; + using ModuleProvidersCache = QHash<CacheKey, ModuleProviderInfo>; + + ModuleProvidersCache providers; + + template<PersistentPool::OpType opType> void completeSerializationOp(PersistentPool &pool) + { + pool.serializationOp<opType>(providers); + } +}; + } // namespace Internal } // namespace qbs diff --git a/src/lib/corelib/language/moduleproviderloader.cpp b/src/lib/corelib/language/moduleproviderloader.cpp index e8e12e216..48eaba0c9 100644 --- a/src/lib/corelib/language/moduleproviderloader.cpp +++ b/src/lib/corelib/language/moduleproviderloader.cpp @@ -66,38 +66,15 @@ ModuleProviderLoader::ModuleProviderLoader(ItemReader *reader, Evaluator *evalua { } -void ModuleProviderLoader::setupKnownModuleProviders(ProductContext &product) -{ - // Existing module provider search paths are re-used if and only if the provider configuration - // at setup time was the same as the current one for the respective module provider. - if (!m_moduleProviderInfo.empty()) { - const QVariantMap configForProduct = moduleProviderConfig(product); - for (const ModuleProviderInfo &c : m_moduleProviderInfo) { - if (configForProduct.value(c.name.toString()).toMap() == c.config) { - qCDebug(lcModuleLoader) << "re-using search paths" << c.searchPaths - << "from module provider" << c.name - << "for product" << product.name; - product.knownModuleProviders.insert(c.name); - product.searchPaths << c.searchPaths; - } - } - } -} - ModuleProviderLoader::ModuleProviderResult ModuleProviderLoader::executeModuleProvider( ProductContext &productContext, const CodeLocation &dependsItemLocation, const QualifiedId &moduleName, FallbackMode fallbackMode) { - bool moduleAlreadyKnown = false; ModuleProviderResult result; for (QualifiedId providerName = moduleName; !providerName.empty(); providerName.pop_back()) { - if (!productContext.knownModuleProviders.insert(providerName).second) { - moduleAlreadyKnown = true; - break; - } qCDebug(lcModuleLoader) << "Module" << moduleName.toString() << "not found, checking for module providers"; result = findModuleProvider(providerName, productContext, @@ -105,8 +82,7 @@ ModuleProviderLoader::ModuleProviderResult ModuleProviderLoader::executeModulePr if (result.providerFound) break; } - if (fallbackMode == FallbackMode::Enabled && !result.providerFound - && !moduleAlreadyKnown) { + if (fallbackMode == FallbackMode::Enabled && !result.providerFound) { qCDebug(lcModuleLoader) << "Specific module provider not found for" << moduleName.toString() << ", setting up fallback."; result = findModuleProvider(moduleName, productContext, @@ -121,32 +97,32 @@ ModuleProviderLoader::ModuleProviderResult ModuleProviderLoader::findModuleProvi ModuleProviderLookup lookupType, const CodeLocation &dependsItemLocation) { - const QString providerFile = findModuleProviderFile(name, lookupType); - if (providerFile.isEmpty()) - return {}; - const QVariantMap config = moduleProviderConfig(product).value(name.toString()).toMap(); - const QStringList searchPaths - = getProviderSearchPaths(name, providerFile, product, config, dependsItemLocation); - const auto addToGlobalInfo = [=] { - m_moduleProviderInfo.emplace_back(ModuleProviderInfo(name, config, - searchPaths, m_parameters.dryRun())); - }; - if (searchPaths.empty()) { + ModuleProviderInfo &info = + m_storedModuleProviderInfo.providers[{name.toString(), config, int(lookupType)}]; + if (info.name.isEmpty()) { // not found in cache + info.name = name; + info.config = config; + info.providerFile = findModuleProviderFile(name, lookupType); + if (info.providerFile.isEmpty()) + return {}; + info.searchPaths = getProviderSearchPaths( + name, info.providerFile, product, config, dependsItemLocation); + info.transientOutput = m_parameters.dryRun(); + } else { + if (info.providerFile.isEmpty()) + return {}; + qCDebug(lcModuleLoader) << "Re-using provider" << name << "from cache"; + } + if (info.searchPaths.empty()) { qCDebug(lcModuleLoader) << "Module provider did run, but did not set up " - "any modules."; - addToGlobalInfo(); + "any modules."; return {true, false}; } - qCDebug(lcModuleLoader) << "Module provider added" << searchPaths.size() + qCDebug(lcModuleLoader) << "Module provider added" << info.searchPaths.size() << "new search path(s)"; - // (1) is needed so the immediate new look-up works. - // (2) is needed so the next use of SearchPathManager considers the new paths. - // (3) is needed for possible re-use in subsequent products and builds. - m_reader->pushExtraSearchPaths(searchPaths); // (1) - product.searchPaths << searchPaths; // (2) - addToGlobalInfo(); // (3) + m_reader->pushExtraSearchPaths(info.searchPaths); return {true, true}; } diff --git a/src/lib/corelib/language/moduleproviderloader.h b/src/lib/corelib/language/moduleproviderloader.h index e5455a1aa..c720d4202 100644 --- a/src/lib/corelib/language/moduleproviderloader.h +++ b/src/lib/corelib/language/moduleproviderloader.h @@ -67,10 +67,14 @@ public: bool providerAddedSearchPaths = false; }; - const ModuleProviderInfoList &moduleProviderInfo() const { return m_moduleProviderInfo; } - void setModuleProviderInfo(ModuleProviderInfoList moduleProviderInfo) + const StoredModuleProviderInfo &storedModuleProviderInfo() const { - m_moduleProviderInfo = std::move(moduleProviderInfo); + return m_storedModuleProviderInfo; + } + + void setStoredModuleProviderInfo(StoredModuleProviderInfo moduleProviderInfo) + { + m_storedModuleProviderInfo = std::move(moduleProviderInfo); } void setProjectParameters(SetupProjectParameters parameters) @@ -78,7 +82,6 @@ public: m_parameters = std::move(parameters); } - void setupKnownModuleProviders(ProductContext &product); ModuleProviderResult executeModuleProvider( ProductContext &productContext, const CodeLocation &dependsItemLocation, @@ -107,7 +110,7 @@ private: Evaluator *const m_evaluator{nullptr}; SetupProjectParameters m_parameters; - ModuleProviderInfoList m_moduleProviderInfo; + StoredModuleProviderInfo m_storedModuleProviderInfo; Set<QString> m_tempQbsFiles; }; diff --git a/src/lib/corelib/language/projectresolver.cpp b/src/lib/corelib/language/projectresolver.cpp index 829cc955a..d3b744892 100644 --- a/src/lib/corelib/language/projectresolver.cpp +++ b/src/lib/corelib/language/projectresolver.cpp @@ -239,7 +239,7 @@ TopLevelProjectPtr ProjectResolver::resolveTopLevelProject() project->buildSystemFiles = m_loadResult.qbsFiles; project->profileConfigs = m_loadResult.profileConfigs; project->probes = m_loadResult.projectProbes; - project->moduleProviderInfo = m_loadResult.moduleProviderInfo; + project->moduleProviderInfo = m_loadResult.storedModuleProviderInfo; ProjectContext projectContext; projectContext.project = project; diff --git a/src/lib/corelib/tools/persistence.cpp b/src/lib/corelib/tools/persistence.cpp index 7c4458b5f..95211e894 100644 --- a/src/lib/corelib/tools/persistence.cpp +++ b/src/lib/corelib/tools/persistence.cpp @@ -48,7 +48,7 @@ namespace qbs { namespace Internal { -static const char QBS_PERSISTENCE_MAGIC[] = "QBSPERSISTENCE-129"; +static const char QBS_PERSISTENCE_MAGIC[] = "QBSPERSISTENCE-130"; NoBuildGraphError::NoBuildGraphError(const QString &filePath) : ErrorInfo(Tr::tr("Build graph not found for configuration '%1'. Expected location was '%2'.") diff --git a/src/lib/corelib/use_corelib.pri b/src/lib/corelib/use_corelib.pri index c674ee664..a0bb90e8b 100644 --- a/src/lib/corelib/use_corelib.pri +++ b/src/lib/corelib/use_corelib.pri @@ -43,5 +43,4 @@ INCLUDEPATH += \ CONFIG(static, static|shared) { DEFINES += QBS_STATIC_LIB } -qbs_enable_project_file_updates:DEFINES += QBS_ENABLE_PROJECT_FILE_UPDATES qbs_enable_unit_tests:DEFINES += QBS_ENABLE_UNIT_TESTS diff --git a/src/lib/corelib/use_installed_corelib.pri b/src/lib/corelib/use_installed_corelib.pri index 4ff72414d..48e020c7b 100644 --- a/src/lib/corelib/use_installed_corelib.pri +++ b/src/lib/corelib/use_installed_corelib.pri @@ -34,5 +34,4 @@ INCLUDEPATH += $${PWD} CONFIG(static, static|shared) { DEFINES += QBS_STATIC_LIB } -qbs_enable_project_file_updates:DEFINES += QBS_ENABLE_PROJECT_FILE_UPDATES qbs_enable_unit_tests:DEFINES += QBS_ENABLE_UNIT_TESTS diff --git a/src/lib/scriptengine/CMakeLists.txt b/src/lib/scriptengine/CMakeLists.txt index 01c6cd09b..b67f9f52c 100644 --- a/src/lib/scriptengine/CMakeLists.txt +++ b/src/lib/scriptengine/CMakeLists.txt @@ -323,16 +323,23 @@ list_transform_prepend(PARSER_SOURCES "${QT_SCRIPT_PATH}/script/parser/") find_package(Perl) -get_target_property(_QT_QMAKE_EXECUTABLE Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION) -get_filename_component(_QT_BIN_DIRECTORY ${_QT_QMAKE_EXECUTABLE} DIRECTORY) +get_target_property(_QT_MOC_EXECUTABLE Qt${QT_VERSION_MAJOR}::moc IMPORTED_LOCATION) +get_filename_component(_QT_LIBEXEC_DIRECTORY ${_QT_MOC_EXECUTABLE} DIRECTORY) file(GLOB API_HEADERS "${QT_SCRIPT_PATH}/script/api/*.h") -message("${QT_SCRIPT_PATH}") +set(EXTERNAL_DEPENDS "") +if(APPLE) + set(EXTERNAL_DEPENDS "-framework CoreFoundation") +endif() + +if(WIN32) + set(EXTERNAL_DEPENDS "winmm") +endif() add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/include/QtScript/qscriptengine.h" - COMMAND ${PERL_EXECUTABLE} "${_QT_BIN_DIRECTORY}/syncqt.pl" + COMMAND ${PERL_EXECUTABLE} "${_QT_LIBEXEC_DIRECTORY}/syncqt.pl" -minimal -version "${QT_VERSION}" -outdir ${CMAKE_CURRENT_BINARY_DIR} @@ -342,9 +349,8 @@ add_custom_command( ) add_qbs_library(qbsscriptengine - STATIC DEFINES ${QT_SCRIPT_DEFINES} - DEPENDS Qt${QT_VERSION_MAJOR}::CorePrivate Qt6Core5Compat + DEPENDS Qt${QT_VERSION_MAJOR}::CorePrivate Qt6Core5Compat ${EXTERNAL_DEPENDS} PUBLIC_DEPENDS ${QT_SCRIPT_PUBLIC_DEPENDS} INCLUDES ${QT_SCRIPT_PUBLIC_INCLUDES} ${QT_SCRIPT_INCLUDES} ${JAVASCRIPT_CORE_INCLUDES} PUBLIC_INCLUDES ${QT_SCRIPT_PUBLIC_INCLUDES} @@ -357,5 +363,4 @@ add_qbs_library(qbsscriptengine ${BRIDGE_SOURCES} ${PARSER_SOURCES} ) -set_property(TARGET qbsscriptengine PROPERTY CXX_STANDARD 14) target_compile_options(qbsscriptengine PRIVATE ${QT_SCRIPT_CXX_FLAGS}) diff --git a/src/lib/scriptengine/include/QtScript/qtscriptglobal.h b/src/lib/scriptengine/include/QtScript/qtscriptglobal.h deleted file mode 100644 index 8b1e09bb1..000000000 --- a/src/lib/scriptengine/include/QtScript/qtscriptglobal.h +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** 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 41e2e0262..b1e6e8bad 100644 --- a/src/lib/scriptengine/scriptengine.pro +++ b/src/lib/scriptengine/scriptengine.pro @@ -10,9 +10,6 @@ DEFINES += JSC=QTJSC jscyyparse=qtjscyyparse jscyylex=qtjscyylex jscyyerror=qt DEFINES += QT_NO_USING_NAMESPACE CONFIG += building-libs -CONFIG += staticlib -CONFIG -= c++17 -CONFIG += c++14 GENERATED_SOURCES_DIR = generated @@ -54,7 +51,11 @@ CONFIG(release, debug|release): DEFINES += NDEBUG DEFINES += JS_NO_EXPORT !build_pass { - qtPrepareTool(QMAKE_SYNCQT, syncqt, , system) + versionAtLeast(QT_VERSION, 6.1.0) { + qtPrepareLibExecTool(QMAKE_SYNCQT, syncqt, , system) + } else { + qtPrepareTool(QMAKE_SYNCQT, syncqt, , system) + } QMAKE_SYNCQT += \ -minimal -version $$[QT_VERSION] \ -outdir $$system_quote($$system_path($$OUT_PWD)) \ diff --git a/src/lib/scriptengine/scriptengine.qbs b/src/lib/scriptengine/scriptengine.qbs index c7061fa98..8183f3bc1 100644 --- a/src/lib/scriptengine/scriptengine.qbs +++ b/src/lib/scriptengine/scriptengine.qbs @@ -3,6 +3,7 @@ import qbs.File import qbs.FileInfo import qbs.Probes import qbs.Process +import qbs.Utilities Project { QbsLibrary { @@ -15,7 +16,10 @@ Project { Depends { name: "QtScriptFwdHeaders" } Depends { name: "cpp" } Depends { name: "Qt"; submodules: ["core-private"] } - type: ["staticlibrary"] + Depends { + name: "Qt.core5compat"; + condition: Utilities.versionCompare(Qt.core.version, "6.0.0") >= 0 + } name: "qbsscriptengine" generatePkgConfigFile: false @@ -24,7 +28,6 @@ Project { property bool useSystemMalloc: !qbs.targetOS.contains("macos") && !qbs.targetOS.contains("unix") property string qtscriptPath: "../../shared/qtscript/src/" - cpp.cxxLanguageVersion: "c++14" cpp.includePaths: { var result = base.concat( ".", @@ -119,10 +122,15 @@ Project { } cpp.warningLevel: "none" cpp.optimization: "fast" // We cannot afford -O0 for QtScript even in debug builds. + cpp.frameworks: base.concat(qbs.targetOS.contains("darwin") ? ["CoreFoundation"] : []) Properties { condition: qbs.targetOS.contains("unix") cpp.dynamicLibraries: base.concat(["pthread"]) } + Properties { + condition: qbs.targetOS.contains("windows") + cpp.dynamicLibraries: base.concat(["winmm"]) + } Group { name: "pcre" @@ -410,7 +418,12 @@ Project { fileTags: ["hpp"] } prepare: { - var syncQtPath = FileInfo.joinPaths(product.Qt.core.binPath, "syncqt.pl"); + var syncQtPath; + if (Utilities.versionCompare(product.Qt.core.version, "6.1") >= 0) { + syncQtPath = FileInfo.joinPaths(product.Qt.core.libExecPath, "syncqt.pl"); + } else { + syncQtPath = FileInfo.joinPaths(product.Qt.core.binPath, "syncqt.pl"); + } if (!File.exists(syncQtPath)) { // syncqt.pl is not in Qt's bin path. We might have a developer build. // As we don't provide QT_HOST_BINS/src in our Qt modules we must diff --git a/src/lib/scriptengine/use_scriptengine.pri b/src/lib/scriptengine/use_scriptengine.pri index e8f82a949..e763c9d86 100644 --- a/src/lib/scriptengine/use_scriptengine.pri +++ b/src/lib/scriptengine/use_scriptengine.pri @@ -12,6 +12,11 @@ LIBS += -lqbsscriptengine$$qtPlatformTargetSuffix() } + isEmpty(QBS_RPATH): QBS_RPATH = ../$$QBS_LIBRARY_DIRNAME + !qbs_disable_rpath { + linux-*: QMAKE_LFLAGS += -Wl,-z,origin \'-Wl,-rpath,\$\$ORIGIN/$${QBS_RPATH}\' + macos: QMAKE_LFLAGS += -Wl,-rpath,@loader_path/$${QBS_RPATH} + } } INCLUDEPATH += \ diff --git a/tests/auto/api/api.pro b/tests/auto/api/api.pro index d9c42e7bb..36dcec237 100644 --- a/tests/auto/api/api.pro +++ b/tests/auto/api/api.pro @@ -13,7 +13,6 @@ isEmpty(QBS_RELATIVE_SEARCH_PATH):QBS_RELATIVE_SEARCH_PATH=.. DEFINES += QBS_RELATIVE_LIBEXEC_PATH=\\\"$${QBS_RELATIVE_LIBEXEC_PATH}\\\" DEFINES += QBS_RELATIVE_PLUGINS_PATH=\\\"$${QBS_RELATIVE_PLUGINS_PATH}\\\" DEFINES += QBS_RELATIVE_SEARCH_PATH=\\\"$${QBS_RELATIVE_SEARCH_PATH}\\\" -qbs_enable_project_file_updates:DEFINES += QBS_ENABLE_PROJECT_FILE_UPDATES include(../auto.pri) diff --git a/tests/auto/api/api.qbs b/tests/auto/api/api.qbs index 09e0af7dc..21ff86a90 100644 --- a/tests/auto/api/api.qbs +++ b/tests/auto/api/api.qbs @@ -9,7 +9,7 @@ QbsAutotest { "QBS_RELATIVE_LIBEXEC_PATH=" + Utilities.cStringQuote(qbsbuildconfig.relativeLibexecPath), "QBS_RELATIVE_SEARCH_PATH=" + Utilities.cStringQuote(qbsbuildconfig.relativeSearchPath), "QBS_RELATIVE_PLUGINS_PATH=" + Utilities.cStringQuote(qbsbuildconfig.relativePluginsPath) - ]).concat(qbsbuildconfig.enableProjectFileUpdates ? ["QBS_ENABLE_PROJECT_FILE_UPDATES"] : []) + ]) Group { name: "testdata" diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp index a51eb3e0c..ac37139a3 100644 --- a/tests/auto/api/tst_api.cpp +++ b/tests/auto/api/tst_api.cpp @@ -620,8 +620,6 @@ qbs::GroupData findGroup(const qbs::ProductData &product, const QString &name) return qbs::GroupData(); } -#ifdef QBS_ENABLE_PROJECT_FILE_UPDATES - static qbs::Project::ProductSelection defaultProducts() { return qbs::Project::ProductSelectionDefaultOnly; @@ -852,8 +850,6 @@ void TestApi::changeContent() QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); } -#endif // QBS_ENABLE_PROJECT_FILE_UPDATES - void TestApi::commandExtraction() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("/command-extraction"); diff --git a/tests/auto/api/tst_api.h b/tests/auto/api/tst_api.h index d6514e17c..cca6d4970 100644 --- a/tests/auto/api/tst_api.h +++ b/tests/auto/api/tst_api.h @@ -69,9 +69,7 @@ private slots: void buildProjectDryRun_data(); void buildSingleFile(); void canonicalToolchainList(); -#ifdef QBS_ENABLE_PROJECT_FILE_UPDATES void changeContent(); -#endif void changeDependentLib(); void checkOutputs(); void checkOutputs_data(); diff --git a/tests/auto/blackbox/testdata-apple/codesign/codesign.qbs b/tests/auto/blackbox/testdata-apple/codesign/codesign.qbs index eafb0be84..08c8f730b 100644 --- a/tests/auto/blackbox/testdata-apple/codesign/codesign.qbs +++ b/tests/auto/blackbox/testdata-apple/codesign/codesign.qbs @@ -9,6 +9,7 @@ Project { CppApplication { name: "A" + version: "1.0.0" bundle.isBundle: project.isBundle files: "app.cpp" codesign.enableCodeSigning: project.enableSigning @@ -23,6 +24,7 @@ Project { DynamicLibrary { Depends { name: "cpp" } name: "B" + version: "1.0.0" bundle.isBundle: project.isBundle files: "app.cpp" codesign.enableCodeSigning: project.enableSigning @@ -36,6 +38,7 @@ Project { LoadableModule { Depends { name: "cpp" } name: "C" + version: "1.0.0" bundle.isBundle: project.isBundle files: "app.cpp" codesign.enableCodeSigning: project.enableSigning diff --git a/tests/auto/blackbox/testdata-windows/codesign/codesign.qbs b/tests/auto/blackbox/testdata-windows/codesign/codesign.qbs index ef6447ab7..f9f49e636 100644 --- a/tests/auto/blackbox/testdata-windows/codesign/codesign.qbs +++ b/tests/auto/blackbox/testdata-windows/codesign/codesign.qbs @@ -14,6 +14,7 @@ Project { codesign.hashAlgorithm: project.hashAlgorithm codesign.subjectName: project.subjectName codesign.signingTimestamp: project.signingTimestamp + codesign.timestampAlgorithm: "sha256" install: true installDir: "" property bool dummy: { @@ -31,6 +32,7 @@ Project { codesign.hashAlgorithm: project.hashAlgorithm codesign.subjectName: project.subjectName codesign.signingTimestamp: project.signingTimestamp + codesign.timestampAlgorithm: "sha256" install: true installDir: "" property bool dummy: { diff --git a/tests/auto/blackbox/tst_blackboxapple.cpp b/tests/auto/blackbox/tst_blackboxapple.cpp index 8fdca3836..2744f907e 100644 --- a/tests/auto/blackbox/tst_blackboxapple.cpp +++ b/tests/auto/blackbox/tst_blackboxapple.cpp @@ -751,7 +751,8 @@ void TestBlackboxApple::codesign() QCOMPARE(codeSignInfo.second.value(QByteArrayLiteral("Signature")), "adhoc"); } - const auto libName = isBundle ? QStringLiteral("B.framework") : QStringLiteral("libB.dylib"); + const auto libName = + isBundle ? QStringLiteral("B.framework") : QStringLiteral("libB.1.0.0.dylib"); const auto libPath = defaultInstallRoot + "/" + libName; QVERIFY(QFileInfo(libPath).exists()); codeSignInfo = getCodeSignInfo(libPath); |